Allow custom bulk actions in admin list tables.
Bulk action filtering was introduced in 3.1, but only to remove default bulk actions, not add new ones.
Bulk actions can now be registered for all admin list table dropdowns via the `bulk_actions-{get_current_screen()->id}` filter. Handling custom bulk actions can be performed in the corresponding and newly introduced `handle_bulk_actions-${get_current_screen()->id}` filter.
Props scribu, flixos90, Veraxus.
See #16031.
Built from https://develop.svn.wordpress.org/trunk@38647
git-svn-id: http://core.svn.wordpress.org/trunk@38590 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -82,6 +82,22 @@ if ( $doaction ) {
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! in_array( $doaction, array( 'approve', 'unapprove', 'spam', 'unspam', 'trash', 'delete' ), true ) ) {
|
||||
/**
|
||||
* Fires when a custom bulk action should be handled.
|
||||
*
|
||||
* The redirect link should be modified with success or failure feedback
|
||||
* from the action to be used to display feedback to the user.
|
||||
*
|
||||
* @since 4.7.0
|
||||
*
|
||||
* @param string $redirect_to The redirect URL.
|
||||
* @param string $doaction The action being taken.
|
||||
* @param array $comment_ids The comments to take the action on.
|
||||
*/
|
||||
$redirect_to = apply_filters( 'handle_bulk_actions-' . get_current_screen()->id, $redirect_to, $doaction, $comment_ids );
|
||||
}
|
||||
|
||||
wp_defer_comment_counting( false );
|
||||
|
||||
if ( $approved )
|
||||
|
||||
Reference in New Issue
Block a user