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:
parent
84d822fc46
commit
870a494015
|
@ -148,7 +148,7 @@ if ( $doaction ) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'trash':
|
case 'trash':
|
||||||
if ( ! isset( $post_ids ) ) {
|
if ( empty( $post_ids ) ) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
foreach ( (array) $post_ids as $post_id ) {
|
foreach ( (array) $post_ids as $post_id ) {
|
||||||
|
@ -169,7 +169,7 @@ if ( $doaction ) {
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'untrash':
|
case 'untrash':
|
||||||
if ( ! isset( $post_ids ) ) {
|
if ( empty( $post_ids ) ) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
foreach ( (array) $post_ids as $post_id ) {
|
foreach ( (array) $post_ids as $post_id ) {
|
||||||
|
@ -184,7 +184,7 @@ if ( $doaction ) {
|
||||||
$location = add_query_arg( 'untrashed', count( $post_ids ), $location );
|
$location = add_query_arg( 'untrashed', count( $post_ids ), $location );
|
||||||
break;
|
break;
|
||||||
case 'delete':
|
case 'delete':
|
||||||
if ( ! isset( $post_ids ) ) {
|
if ( empty( $post_ids ) ) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
foreach ( (array) $post_ids as $post_id_del ) {
|
foreach ( (array) $post_ids as $post_id_del ) {
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @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.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue