Media: Ensure `$post_ids` is evaluated properly when processing bulk actions.

After [51111], the `$post_ids` variable is now initialized as an empty array when processing a bulk action.  As such, the original check using `isset` on `$post_ids` will always evaluate to `true`.  This change swaps the `isset` checks for `empty` to check array length instead.

Props david.binda, hellofromTonya.
Fixes #53411.
Built from https://develop.svn.wordpress.org/trunk@51161


git-svn-id: http://core.svn.wordpress.org/trunk@50770 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
davidbaumwald 2021-06-15 16:51:59 +00:00
parent 84d822fc46
commit 870a494015
2 changed files with 4 additions and 4 deletions

View File

@ -148,7 +148,7 @@ if ( $doaction ) {
break;
case 'trash':
if ( ! isset( $post_ids ) ) {
if ( empty( $post_ids ) ) {
break;
}
foreach ( (array) $post_ids as $post_id ) {
@ -169,7 +169,7 @@ if ( $doaction ) {
);
break;
case 'untrash':
if ( ! isset( $post_ids ) ) {
if ( empty( $post_ids ) ) {
break;
}
foreach ( (array) $post_ids as $post_id ) {
@ -184,7 +184,7 @@ if ( $doaction ) {
$location = add_query_arg( 'untrashed', count( $post_ids ), $location );
break;
case 'delete':
if ( ! isset( $post_ids ) ) {
if ( empty( $post_ids ) ) {
break;
}
foreach ( (array) $post_ids as $post_id_del ) {

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.8-beta1-51160';
$wp_version = '5.8-beta1-51161';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.