Partially revert [15642]. Fixes Bulk deletion of non-media items. As a bonus, exit on redirects & check the post status is valid before querying it. See #14579
git-svn-id: https://develop.svn.wordpress.org/trunk@15667 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
57af0bf212
commit
faf15fa40e
@ -31,16 +31,21 @@ if ( $doaction ) {
|
|||||||
$sendback = admin_url($post_new_file);
|
$sendback = admin_url($post_new_file);
|
||||||
|
|
||||||
if ( 'delete_all' == $doaction ) {
|
if ( 'delete_all' == $doaction ) {
|
||||||
$post_ids = $wpdb->get_col( "SELECT ID FROM $wpdb->posts WHERE post_type='attachment' AND post_status = 'trash'" );
|
$post_status = preg_replace('/[^a-z0-9_-]+/i', '', $_REQUEST['post_status']);
|
||||||
|
if ( get_post_status_object($post_status) ) // Check the post status exists first
|
||||||
|
$post_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type=%s AND post_status = %s", $post_type, $post_status ) );
|
||||||
$doaction = 'delete';
|
$doaction = 'delete';
|
||||||
} elseif ( isset( $_REQUEST['media'] ) ) {
|
} elseif ( isset( $_REQUEST['media'] ) ) {
|
||||||
$post_ids = $_REQUEST['media'];
|
$post_ids = $_REQUEST['media'];
|
||||||
} elseif ( isset( $_REQUEST['ids'] ) ) {
|
} elseif ( isset( $_REQUEST['ids'] ) ) {
|
||||||
$post_ids = explode( ',', $_REQUEST['ids'] );
|
$post_ids = explode( ',', $_REQUEST['ids'] );
|
||||||
|
} elseif ( !empty( $_REQUEST['post'] ) ) {
|
||||||
|
$post_ids = array_map('intval', $_REQUEST['post']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !isset( $post_ids ) ) {
|
if ( !isset( $post_ids ) ) {
|
||||||
wp_redirect( admin_url("edit.php?post_type=$post_type") );
|
wp_redirect( admin_url("edit.php?post_type=$post_type") );
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ( $doaction ) {
|
switch ( $doaction ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user