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.

git-svn-id: https://develop.svn.wordpress.org/trunk@51161 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
David Baumwald 2021-06-15 16:50:49 +00:00
parent ba65211c29
commit 3beac35843

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 ) {