WordPress.org

Make WordPress Core

Ticket #31570: 31570.diff

File 31570.diff, 475 bytes (added by fuhton, 4 years ago)

array_filter removes any values that are false, but doesn't reset the array indexes and will eventually cause ajax response errors.

  • wp-admin/includes/ajax-actions.php

     
    23762376        $query = new WP_Query( $query );
    23772377
    23782378        $posts = array_map( 'wp_prepare_attachment_for_js', $query->posts );
    2379         $posts = array_filter( $posts );
     2379        $posts = array_values( array_filter( $posts ) );
    23802380
    23812381        wp_send_json_success( $posts );
    23822382}