179 $sendback = add_query_arg( $done, $sendback ); |
180 $sendback = add_query_arg( $done, $sendback ); |
180 } |
181 } |
181 } |
182 } |
182 break; |
183 break; |
183 default: |
184 default: |
184 /** This action is documented in wp-admin/edit-comments.php */ |
185 $screen = get_current_screen()->id; |
185 $sendback = apply_filters( 'handle_bulk_actions-' . get_current_screen()->id, $sendback, $doaction, $post_ids ); |
186 |
|
187 /** |
|
188 * Fires when a custom bulk action should be handled. |
|
189 * |
|
190 * The redirect link should be modified with success or failure feedback |
|
191 * from the action to be used to display feedback to the user. |
|
192 * |
|
193 * The dynamic portion of the hook name, `$screen`, refers to the current screen ID. |
|
194 * |
|
195 * @since 4.7.0 |
|
196 * |
|
197 * @param string $sendback The redirect URL. |
|
198 * @param string $doaction The action being taken. |
|
199 * @param array $items The items to take the action on. Accepts an array of IDs of posts, |
|
200 * comments, terms, links, plugins, attachments, or users. |
|
201 */ |
|
202 $sendback = apply_filters( "handle_bulk_actions-{$screen}", $sendback, $doaction, $post_ids ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
186 break; |
203 break; |
187 } |
204 } |
188 |
205 |
189 $sendback = remove_query_arg( array( 'action', 'action2', 'tags_input', 'post_author', 'comment_status', 'ping_status', '_status', 'post', 'bulk_edit', 'post_view' ), $sendback ); |
206 $sendback = remove_query_arg( array( 'action', 'action2', 'tags_input', 'post_author', 'comment_status', 'ping_status', '_status', 'post', 'bulk_edit', 'post_view' ), $sendback ); |
190 |
207 |
191 wp_redirect( $sendback ); |
208 wp_redirect( $sendback ); |
192 exit(); |
209 exit; |
193 } elseif ( ! empty( $_REQUEST['_wp_http_referer'] ) ) { |
210 } elseif ( ! empty( $_REQUEST['_wp_http_referer'] ) ) { |
194 wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ); |
211 wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ); |
195 exit; |
212 exit; |
196 } |
213 } |
197 |
214 |
205 wp_enqueue_style( 'wp-list-reusable-blocks' ); |
222 wp_enqueue_style( 'wp-list-reusable-blocks' ); |
206 } |
223 } |
207 |
224 |
208 $title = $post_type_object->labels->name; |
225 $title = $post_type_object->labels->name; |
209 |
226 |
210 if ( 'post' == $post_type ) { |
227 if ( 'post' === $post_type ) { |
211 get_current_screen()->add_help_tab( |
228 get_current_screen()->add_help_tab( |
212 array( |
229 array( |
213 'id' => 'overview', |
230 'id' => 'overview', |
214 'title' => __( 'Overview' ), |
231 'title' => __( 'Overview' ), |
215 'content' => |
232 'content' => |
216 '<p>' . __( 'This screen provides access to all of your posts. You can customize the display of this screen to suit your workflow.' ) . '</p>', |
233 '<p>' . __( 'This screen provides access to all of your posts. You can customize the display of this screen to suit your workflow.' ) . '</p>', |
217 ) |
234 ) |
218 ); |
235 ); |
219 get_current_screen()->add_help_tab( |
236 get_current_screen()->add_help_tab( |
220 array( |
237 array( |
221 'id' => 'screen-content', |
238 'id' => 'screen-content', |
222 'title' => __( 'Screen Content' ), |
239 'title' => __( 'Screen Content' ), |
223 'content' => |
240 'content' => |
224 '<p>' . __( 'You can customize the display of this screen’s contents in a number of ways:' ) . '</p>' . |
241 '<p>' . __( 'You can customize the display of this screen’s contents in a number of ways:' ) . '</p>' . |
225 '<ul>' . |
242 '<ul>' . |
226 '<li>' . __( 'You can hide/display columns based on your needs and decide how many posts to list per screen using the Screen Options tab.' ) . '</li>' . |
243 '<li>' . __( 'You can hide/display columns based on your needs and decide how many posts to list per screen using the Screen Options tab.' ) . '</li>' . |
227 '<li>' . __( 'You can filter the list of posts by post status using the text links above the posts list to only show posts with that status. The default view is to show all posts.' ) . '</li>' . |
244 '<li>' . __( 'You can filter the list of posts by post status using the text links above the posts list to only show posts with that status. The default view is to show all posts.' ) . '</li>' . |
228 '<li>' . __( 'You can view posts in a simple title list or with an excerpt using the Screen Options tab.' ) . '</li>' . |
245 '<li>' . __( 'You can view posts in a simple title list or with an excerpt using the Screen Options tab.' ) . '</li>' . |
229 '<li>' . __( 'You can refine the list to show only posts in a specific category or from a specific month by using the dropdown menus above the posts list. Click the Filter button after making your selection. You also can refine the list by clicking on the post author, category or tag in the posts list.' ) . '</li>' . |
246 '<li>' . __( 'You can refine the list to show only posts in a specific category or from a specific month by using the dropdown menus above the posts list. Click the Filter button after making your selection. You also can refine the list by clicking on the post author, category or tag in the posts list.' ) . '</li>' . |
230 '</ul>', |
247 '</ul>', |
231 ) |
248 ) |
232 ); |
249 ); |
233 get_current_screen()->add_help_tab( |
250 get_current_screen()->add_help_tab( |
234 array( |
251 array( |
235 'id' => 'action-links', |
252 'id' => 'action-links', |
236 'title' => __( 'Available Actions' ), |
253 'title' => __( 'Available Actions' ), |
237 'content' => |
254 'content' => |
238 '<p>' . __( 'Hovering over a row in the posts list will display action links that allow you to manage your post. You can perform the following actions:' ) . '</p>' . |
255 '<p>' . __( 'Hovering over a row in the posts list will display action links that allow you to manage your post. You can perform the following actions:' ) . '</p>' . |
239 '<ul>' . |
256 '<ul>' . |
240 '<li>' . __( '<strong>Edit</strong> takes you to the editing screen for that post. You can also reach that screen by clicking on the post title.' ) . '</li>' . |
257 '<li>' . __( '<strong>Edit</strong> takes you to the editing screen for that post. You can also reach that screen by clicking on the post title.' ) . '</li>' . |
241 '<li>' . __( '<strong>Quick Edit</strong> provides inline access to the metadata of your post, allowing you to update post details without leaving this screen.' ) . '</li>' . |
258 '<li>' . __( '<strong>Quick Edit</strong> provides inline access to the metadata of your post, allowing you to update post details without leaving this screen.' ) . '</li>' . |
242 '<li>' . __( '<strong>Trash</strong> removes your post from this list and places it in the trash, from which you can permanently delete it.' ) . '</li>' . |
259 '<li>' . __( '<strong>Trash</strong> removes your post from this list and places it in the Trash, from which you can permanently delete it.' ) . '</li>' . |
243 '<li>' . __( '<strong>Preview</strong> will show you what your draft post will look like if you publish it. View will take you to your live site to view the post. Which link is available depends on your post’s status.' ) . '</li>' . |
260 '<li>' . __( '<strong>Preview</strong> will show you what your draft post will look like if you publish it. View will take you to your live site to view the post. Which link is available depends on your post’s status.' ) . '</li>' . |
244 '</ul>', |
261 '</ul>', |
245 ) |
262 ) |
246 ); |
263 ); |
247 get_current_screen()->add_help_tab( |
264 get_current_screen()->add_help_tab( |
248 array( |
265 array( |
249 'id' => 'bulk-actions', |
266 'id' => 'bulk-actions', |
250 'title' => __( 'Bulk Actions' ), |
267 'title' => __( 'Bulk actions' ), |
251 'content' => |
268 'content' => |
252 '<p>' . __( 'You can also edit or move multiple posts to the trash at once. Select the posts you want to act on using the checkboxes, then select the action you want to take from the Bulk Actions menu and click Apply.' ) . '</p>' . |
269 '<p>' . __( 'You can also edit or move multiple posts to the Trash at once. Select the posts you want to act on using the checkboxes, then select the action you want to take from the Bulk actions menu and click Apply.' ) . '</p>' . |
253 '<p>' . __( 'When using Bulk Edit, you can change the metadata (categories, author, etc.) for all selected posts at once. To remove a post from the grouping, just click the x next to its name in the Bulk Edit area that appears.' ) . '</p>', |
270 '<p>' . __( 'When using Bulk Edit, you can change the metadata (categories, author, etc.) for all selected posts at once. To remove a post from the grouping, just click the x next to its name in the Bulk Edit area that appears.' ) . '</p>', |
254 ) |
271 ) |
255 ); |
272 ); |
256 |
273 |
257 get_current_screen()->set_help_sidebar( |
274 get_current_screen()->set_help_sidebar( |
258 '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
275 '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
259 '<p>' . __( '<a href="https://codex.wordpress.org/Posts_Screen">Documentation on Managing Posts</a>' ) . '</p>' . |
276 '<p>' . __( '<a href="https://wordpress.org/support/article/posts-screen/">Documentation on Managing Posts</a>' ) . '</p>' . |
260 '<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>' |
277 '<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>' |
261 ); |
278 ); |
262 |
279 |
263 } elseif ( 'page' == $post_type ) { |
280 } elseif ( 'page' === $post_type ) { |
264 get_current_screen()->add_help_tab( |
281 get_current_screen()->add_help_tab( |
265 array( |
282 array( |
266 'id' => 'overview', |
283 'id' => 'overview', |
267 'title' => __( 'Overview' ), |
284 'title' => __( 'Overview' ), |
268 'content' => |
285 'content' => |
269 '<p>' . __( 'Pages are similar to posts in that they have a title, body text, and associated metadata, but they are different in that they are not part of the chronological blog stream, kind of like permanent posts. Pages are not categorized or tagged, but can have a hierarchy. You can nest pages under other pages by making one the “Parent” of the other, creating a group of pages.' ) . '</p>', |
286 '<p>' . __( 'Pages are similar to posts in that they have a title, body text, and associated metadata, but they are different in that they are not part of the chronological blog stream, kind of like permanent posts. Pages are not categorized or tagged, but can have a hierarchy. You can nest pages under other pages by making one the “Parent” of the other, creating a group of pages.' ) . '</p>', |
270 ) |
287 ) |
271 ); |
288 ); |
272 get_current_screen()->add_help_tab( |
289 get_current_screen()->add_help_tab( |
273 array( |
290 array( |
274 'id' => 'managing-pages', |
291 'id' => 'managing-pages', |
275 'title' => __( 'Managing Pages' ), |
292 'title' => __( 'Managing Pages' ), |
276 'content' => |
293 'content' => |
277 '<p>' . __( 'Managing pages is very similar to managing posts, and the screens can be customized in the same way.' ) . '</p>' . |
294 '<p>' . __( 'Managing pages is very similar to managing posts, and the screens can be customized in the same way.' ) . '</p>' . |
278 '<p>' . __( 'You can also perform the same types of actions, including narrowing the list by using the filters, acting on a page using the action links that appear when you hover over a row, or using the Bulk Actions menu to edit the metadata for multiple pages at once.' ) . '</p>', |
295 '<p>' . __( 'You can also perform the same types of actions, including narrowing the list by using the filters, acting on a page using the action links that appear when you hover over a row, or using the Bulk actions menu to edit the metadata for multiple pages at once.' ) . '</p>', |
279 ) |
296 ) |
280 ); |
297 ); |
281 |
298 |
282 get_current_screen()->set_help_sidebar( |
299 get_current_screen()->set_help_sidebar( |
283 '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
300 '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
284 '<p>' . __( '<a href="https://codex.wordpress.org/Pages_Screen">Documentation on Managing Pages</a>' ) . '</p>' . |
301 '<p>' . __( '<a href="https://wordpress.org/support/article/pages-screen/">Documentation on Managing Pages</a>' ) . '</p>' . |
285 '<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>' |
302 '<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>' |
286 ); |
303 ); |
287 |
304 |
288 } |
305 } |
289 |
306 |
311 'untrashed' => isset( $_REQUEST['untrashed'] ) ? absint( $_REQUEST['untrashed'] ) : 0, |
328 'untrashed' => isset( $_REQUEST['untrashed'] ) ? absint( $_REQUEST['untrashed'] ) : 0, |
312 ); |
329 ); |
313 |
330 |
314 $bulk_messages = array(); |
331 $bulk_messages = array(); |
315 $bulk_messages['post'] = array( |
332 $bulk_messages['post'] = array( |
|
333 /* translators: %s: Number of posts. */ |
316 'updated' => _n( '%s post updated.', '%s posts updated.', $bulk_counts['updated'] ), |
334 'updated' => _n( '%s post updated.', '%s posts updated.', $bulk_counts['updated'] ), |
317 'locked' => ( 1 == $bulk_counts['locked'] ) ? __( '1 post not updated, somebody is editing it.' ) : |
335 'locked' => ( 1 === $bulk_counts['locked'] ) ? __( '1 post not updated, somebody is editing it.' ) : |
|
336 /* translators: %s: Number of posts. */ |
318 _n( '%s post not updated, somebody is editing it.', '%s posts not updated, somebody is editing them.', $bulk_counts['locked'] ), |
337 _n( '%s post not updated, somebody is editing it.', '%s posts not updated, somebody is editing them.', $bulk_counts['locked'] ), |
|
338 /* translators: %s: Number of posts. */ |
319 'deleted' => _n( '%s post permanently deleted.', '%s posts permanently deleted.', $bulk_counts['deleted'] ), |
339 'deleted' => _n( '%s post permanently deleted.', '%s posts permanently deleted.', $bulk_counts['deleted'] ), |
|
340 /* translators: %s: Number of posts. */ |
320 'trashed' => _n( '%s post moved to the Trash.', '%s posts moved to the Trash.', $bulk_counts['trashed'] ), |
341 'trashed' => _n( '%s post moved to the Trash.', '%s posts moved to the Trash.', $bulk_counts['trashed'] ), |
|
342 /* translators: %s: Number of posts. */ |
321 'untrashed' => _n( '%s post restored from the Trash.', '%s posts restored from the Trash.', $bulk_counts['untrashed'] ), |
343 'untrashed' => _n( '%s post restored from the Trash.', '%s posts restored from the Trash.', $bulk_counts['untrashed'] ), |
322 ); |
344 ); |
323 $bulk_messages['page'] = array( |
345 $bulk_messages['page'] = array( |
|
346 /* translators: %s: Number of pages. */ |
324 'updated' => _n( '%s page updated.', '%s pages updated.', $bulk_counts['updated'] ), |
347 'updated' => _n( '%s page updated.', '%s pages updated.', $bulk_counts['updated'] ), |
325 'locked' => ( 1 == $bulk_counts['locked'] ) ? __( '1 page not updated, somebody is editing it.' ) : |
348 'locked' => ( 1 === $bulk_counts['locked'] ) ? __( '1 page not updated, somebody is editing it.' ) : |
|
349 /* translators: %s: Number of pages. */ |
326 _n( '%s page not updated, somebody is editing it.', '%s pages not updated, somebody is editing them.', $bulk_counts['locked'] ), |
350 _n( '%s page not updated, somebody is editing it.', '%s pages not updated, somebody is editing them.', $bulk_counts['locked'] ), |
|
351 /* translators: %s: Number of pages. */ |
327 'deleted' => _n( '%s page permanently deleted.', '%s pages permanently deleted.', $bulk_counts['deleted'] ), |
352 'deleted' => _n( '%s page permanently deleted.', '%s pages permanently deleted.', $bulk_counts['deleted'] ), |
|
353 /* translators: %s: Number of pages. */ |
328 'trashed' => _n( '%s page moved to the Trash.', '%s pages moved to the Trash.', $bulk_counts['trashed'] ), |
354 'trashed' => _n( '%s page moved to the Trash.', '%s pages moved to the Trash.', $bulk_counts['trashed'] ), |
|
355 /* translators: %s: Number of pages. */ |
329 'untrashed' => _n( '%s page restored from the Trash.', '%s pages restored from the Trash.', $bulk_counts['untrashed'] ), |
356 'untrashed' => _n( '%s page restored from the Trash.', '%s pages restored from the Trash.', $bulk_counts['untrashed'] ), |
330 ); |
357 ); |
331 $bulk_messages['wp_block'] = array( |
358 $bulk_messages['wp_block'] = array( |
|
359 /* translators: %s: Number of blocks. */ |
332 'updated' => _n( '%s block updated.', '%s blocks updated.', $bulk_counts['updated'] ), |
360 'updated' => _n( '%s block updated.', '%s blocks updated.', $bulk_counts['updated'] ), |
333 'locked' => ( 1 == $bulk_counts['locked'] ) ? __( '1 block not updated, somebody is editing it.' ) : _n( '%s block not updated, somebody is editing it.', '%s blocks not updated, somebody is editing them.', $bulk_counts['locked'] ), |
361 'locked' => ( 1 === $bulk_counts['locked'] ) ? __( '1 block not updated, somebody is editing it.' ) : |
|
362 /* translators: %s: Number of blocks. */ |
|
363 _n( '%s block not updated, somebody is editing it.', '%s blocks not updated, somebody is editing them.', $bulk_counts['locked'] ), |
|
364 /* translators: %s: Number of blocks. */ |
334 'deleted' => _n( '%s block permanently deleted.', '%s blocks permanently deleted.', $bulk_counts['deleted'] ), |
365 'deleted' => _n( '%s block permanently deleted.', '%s blocks permanently deleted.', $bulk_counts['deleted'] ), |
|
366 /* translators: %s: Number of blocks. */ |
335 'trashed' => _n( '%s block moved to the Trash.', '%s blocks moved to the Trash.', $bulk_counts['trashed'] ), |
367 'trashed' => _n( '%s block moved to the Trash.', '%s blocks moved to the Trash.', $bulk_counts['trashed'] ), |
|
368 /* translators: %s: Number of blocks. */ |
336 'untrashed' => _n( '%s block restored from the Trash.', '%s blocks restored from the Trash.', $bulk_counts['untrashed'] ), |
369 'untrashed' => _n( '%s block restored from the Trash.', '%s blocks restored from the Trash.', $bulk_counts['untrashed'] ), |
337 ); |
370 ); |
338 |
371 |
339 /** |
372 /** |
340 * Filters the bulk action updated messages. |
373 * Filters the bulk action updated messages. |