mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-01 03:04:34 +00:00
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.
git-svn-id: https://develop.svn.wordpress.org/trunk@38647 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -162,6 +162,21 @@ if ( $doaction ) {
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
/**
|
||||
* Fires when a custom bulk action should be handled.
|
||||
*
|
||||
* The sendback 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 $sendback The redirect URL.
|
||||
* @param string $doaction The action being taken.
|
||||
* @param array $post_ids The post IDs to take the action on.
|
||||
*/
|
||||
$sendback = apply_filters( 'handle_bulk_actions-' . get_current_screen()->id, $sendback, $doaction, $post_ids );
|
||||
break;
|
||||
}
|
||||
|
||||
$sendback = remove_query_arg( array('action', 'action2', 'tags_input', 'post_author', 'comment_status', 'ping_status', '_status', 'post', 'bulk_edit', 'post_view'), $sendback );
|
||||
|
||||
Reference in New Issue
Block a user