Docs: Move the canonical DocBlock for `handle_bulk_actions-{$screen}` action to `wp-admin/edit.php`.

* Document accepted values for the `$items` parameter.
* Use interpolated syntax for the filter name.

Props dilipbheda, johnbillion, SergeyBiryukov.
Fixes #48857.
Built from https://develop.svn.wordpress.org/trunk@46811


git-svn-id: http://core.svn.wordpress.org/trunk@46611 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2019-12-03 13:58:05 +00:00
parent 6d1ed93c91
commit a5e52e04ee
8 changed files with 44 additions and 31 deletions

View File

@ -92,20 +92,7 @@ if ( $doaction ) {
if ( ! in_array( $doaction, array( 'approve', 'unapprove', 'spam', 'unspam', 'trash', 'delete' ), true ) ) {
$screen = get_current_screen()->id;
/**
* 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.
*
* The dynamic portion of the hook name, `$screen`, refers to the current screen ID.
*
* @since 4.7.0
*
* @param string $redirect_url The redirect URL.
* @param string $doaction The action being taken.
* @param array $items The items to take the action on.
*/
/** This action is documented in wp-admin/edit.php */
$redirect_to = apply_filters( "handle_bulk_actions-{$screen}", $redirect_to, $doaction, $comment_ids ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
}

View File

@ -199,9 +199,12 @@ switch ( $wp_list_table->current_action() ) {
break;
}
check_admin_referer( 'bulk-tags' );
$screen = get_current_screen()->id;
$tags = (array) $_REQUEST['delete_tags'];
/** This action is documented in wp-admin/edit-comments.php */
$location = apply_filters( 'handle_bulk_actions-' . get_current_screen()->id, $location, $wp_list_table->current_action(), $tags ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
/** This action is documented in wp-admin/edit.php */
$location = apply_filters( "handle_bulk_actions-{$screen}", $location, $wp_list_table->current_action(), $tags ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
break;
}

View File

@ -182,8 +182,24 @@ if ( $doaction ) {
}
break;
default:
/** This action is documented in wp-admin/edit-comments.php */
$sendback = apply_filters( 'handle_bulk_actions-' . get_current_screen()->id, $sendback, $doaction, $post_ids ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
$screen = get_current_screen()->id;
/**
* 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.
*
* The dynamic portion of the hook name, `$screen`, refers to the current screen ID.
*
* @since 4.7.0
*
* @param string $sendback The redirect URL.
* @param string $doaction The action being taken.
* @param array $items The items to take the action on. Accepts an array of IDs of posts,
* comments, terms, links, plugins, attachments, or users.
*/
$sendback = apply_filters( "handle_bulk_actions-{$screen}", $sendback, $doaction, $post_ids ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
break;
}

View File

@ -32,8 +32,10 @@ if ( $doaction && isset( $_REQUEST['linkcheck'] ) ) {
$redirect_to = add_query_arg( 'deleted', count( $bulklinks ), $redirect_to );
} else {
/** This action is documented in wp-admin/edit-comments.php */
$redirect_to = apply_filters( 'handle_bulk_actions-' . get_current_screen()->id, $redirect_to, $doaction, $bulklinks ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
$screen = get_current_screen()->id;
/** This action is documented in wp-admin/edit.php */
$redirect_to = apply_filters( "handle_bulk_actions-{$screen}", $redirect_to, $doaction, $bulklinks ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
}
wp_redirect( $redirect_to );
exit;

View File

@ -414,11 +414,13 @@ if ( $action ) {
default:
if ( isset( $_POST['checked'] ) ) {
check_admin_referer( 'bulk-plugins' );
$plugins = isset( $_POST['checked'] ) ? (array) wp_unslash( $_POST['checked'] ) : array();
$sendback = wp_get_referer();
/** This action is documented in wp-admin/edit-comments.php */
$sendback = apply_filters( 'handle_bulk_actions-' . get_current_screen()->id, $sendback, $action, $plugins ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
$screen = get_current_screen()->id;
$sendback = wp_get_referer();
$plugins = isset( $_POST['checked'] ) ? (array) wp_unslash( $_POST['checked'] ) : array();
/** This action is documented in wp-admin/edit.php */
$sendback = apply_filters( "handle_bulk_actions-{$screen}", $sendback, $action, $plugins ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
wp_safe_redirect( $sendback );
exit;
}

View File

@ -198,8 +198,10 @@ if ( $doaction ) {
$location = add_query_arg( 'deleted', count( $post_ids ), $location );
break;
default:
/** This action is documented in wp-admin/edit-comments.php */
$location = apply_filters( 'handle_bulk_actions-' . get_current_screen()->id, $location, $doaction, $post_ids ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
$screen = get_current_screen()->id;
/** This action is documented in wp-admin/edit.php */
$location = apply_filters( "handle_bulk_actions-{$screen}", $location, $doaction, $post_ids ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
}
wp_redirect( $location );

View File

@ -456,11 +456,12 @@ switch ( $wp_list_table->current_action() ) {
}
if ( $wp_list_table->current_action() && ! empty( $_REQUEST['users'] ) ) {
$userids = $_REQUEST['users'];
$screen = get_current_screen()->id;
$sendback = wp_get_referer();
$userids = $_REQUEST['users'];
/** This action is documented in wp-admin/edit-comments.php */
$sendback = apply_filters( 'handle_bulk_actions-' . get_current_screen()->id, $sendback, $wp_list_table->current_action(), $userids ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
/** This action is documented in wp-admin/edit.php */
$sendback = apply_filters( "handle_bulk_actions-{$screen}", $sendback, $wp_list_table->current_action(), $userids ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
wp_safe_redirect( $sendback );
exit;

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.4-alpha-46810';
$wp_version = '5.4-alpha-46811';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.