From 3beac35843bc07dac2db847530f051641eb73cfc Mon Sep 17 00:00:00 2001 From: David Baumwald Date: Tue, 15 Jun 2021 16:50:49 +0000 Subject: [PATCH] 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 --- src/wp-admin/upload.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/wp-admin/upload.php b/src/wp-admin/upload.php index d307453dc1..d29914114a 100644 --- a/src/wp-admin/upload.php +++ b/src/wp-admin/upload.php @@ -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 ) {