mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +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:
@@ -160,6 +160,26 @@ if ( isset( $_GET['action'] ) ) {
|
||||
wp_die( __( 'Sorry, you are not allowed to change the current site.' ) );
|
||||
}
|
||||
}
|
||||
if ( ! in_array( $doaction, array( 'delete', 'spam', 'notspam' ), true ) ) {
|
||||
$redirect_to = wp_get_referer();
|
||||
$blogs = (array) $_POST['allblogs'];
|
||||
/**
|
||||
* 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 $blogs The blogs to take the action on.
|
||||
* @param int $site_id The current site id.
|
||||
*/
|
||||
$redirect_to = apply_filters( 'handle_bulk_actions-' . get_current_screen()->id, $redirect_to, $doaction, $blogs, $id );
|
||||
wp_safe_redirect( $redirect_to );
|
||||
exit();
|
||||
}
|
||||
} else {
|
||||
$location = network_admin_url( 'sites.php' );
|
||||
if ( ! empty( $_REQUEST['paged'] ) ) {
|
||||
|
||||
Reference in New Issue
Block a user