Make WordPress Core

Ticket #56170: typecast-postid-bulk-delete-attachments.diff

File typecast-postid-bulk-delete-attachments.diff, 679 bytes (added by eherman24, 3 years ago)
  • src/wp-admin/upload.php

     
    190190                                break;
    191191                        }
    192192                        foreach ( (array) $post_ids as $post_id_del ) {
    193                                 if ( ! current_user_can( 'delete_post', $post_id_del ) ) {
     193                                if ( ! current_user_can( 'delete_post', (int) $post_id_del ) ) {
    194194                                        wp_die( __( 'Sorry, you are not allowed to delete this item.' ) );
    195195                                }
    196196
    197                                 if ( ! wp_delete_attachment( $post_id_del ) ) {
     197                                if ( ! wp_delete_attachment( (int) $post_id_del ) ) {
    198198                                        wp_die( __( 'Error in deleting the attachment.' ) );
    199199                                }
    200200                        }