WordPress.org

Make WordPress Core

Changeset 49567


Ignore:
Timestamp:
11/12/2020 03:38:32 PM (2 months ago)
Author:
antpb
Message:

Media: Improve count in Media Library pagination.

Deleting all visible items on the last page of the media library previously left a blank page with no media items available. Using wp_count_attachements instead of found_posts solves the problem.

Props donsony, karmatosed, desrosj, mista-flo, justinahinon.

Fixes #39968.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-media-list-table.php

    r49193 r49567  
    101101        $this->set_pagination_args(
    102102            array(
    103                 'total_items' => $wp_query->found_posts,
    104                 'total_pages' => $wp_query->max_num_pages,
     103                'total_items' => array_sum( (array) wp_count_attachments() ),
    105104                'per_page'    => $wp_query->query_vars['posts_per_page'],
    106105            )
Note: See TracChangeset for help on using the changeset viewer.