WordPress.org

Make WordPress Core

Ticket #16164: 16164.diff

File 16164.diff, 470 bytes (added by solarissmoke, 9 years ago)

Don't fall over when trying to delete a non-existent media item

  • wp-admin/upload.php

     
    111111                        break;
    112112                case 'delete':
    113113                        foreach ( (array) $post_ids as $post_id_del ) {
     114                                if( ! get_post( $post_id_del ) )
     115                                        continue;
     116                               
    114117                                if ( !current_user_can( 'delete_post', $post_id_del ) )
    115118                                        wp_die( __( 'You are not allowed to delete this post.' ) );
    116119