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.

Built from https://develop.svn.wordpress.org/trunk@49567


git-svn-id: http://core.svn.wordpress.org/trunk@49305 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
antpb 2020-11-12 15:40:09 +00:00
parent abc9d961d5
commit 8efbef867c
2 changed files with 2 additions and 3 deletions

View File

@ -100,8 +100,7 @@ class WP_Media_List_Table extends WP_List_Table {
$this->set_pagination_args(
array(
'total_items' => $wp_query->found_posts,
'total_pages' => $wp_query->max_num_pages,
'total_items' => array_sum( (array) wp_count_attachments() ),
'per_page' => $wp_query->query_vars['posts_per_page'],
)
);

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.6-beta3-49566';
$wp_version = '5.6-beta3-49567';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.