WordPress.org

Make WordPress Core

Changeset 15667


Ignore:
Timestamp:
09/26/2010 10:56:36 AM (9 years ago)
Author:
dd32
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/edit.php

    r15642 r15667  
    3232
    3333    if ( 'delete_all' == $doaction ) {
    34         $post_ids = $wpdb->get_col( "SELECT ID FROM $wpdb->posts WHERE post_type='attachment' AND post_status = 'trash'" );
     34        $post_status = preg_replace('/[^a-z0-9_-]+/i', '', $_REQUEST['post_status']);
     35        if ( get_post_status_object($post_status) ) // Check the post status exists first
     36            $post_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type=%s AND post_status = %s", $post_type, $post_status ) );
    3537        $doaction = 'delete';
    3638    } elseif ( isset( $_REQUEST['media'] ) ) {
     
    3840    } elseif ( isset( $_REQUEST['ids'] ) ) {
    3941        $post_ids = explode( ',', $_REQUEST['ids'] );
     42    } elseif ( !empty( $_REQUEST['post'] ) ) {
     43        $post_ids = array_map('intval', $_REQUEST['post']);
    4044    }
    4145
    4246    if ( !isset( $post_ids ) ) {
    4347        wp_redirect( admin_url("edit.php?post_type=$post_type") );
     48        exit;
    4449    }
    4550
Note: See TracChangeset for help on using the changeset viewer.