From 8efbef867c0abbcd6996565835edf7a14cf165d0 Mon Sep 17 00:00:00 2001 From: antpb Date: Thu, 12 Nov 2020 15:40:09 +0000 Subject: [PATCH] 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 --- wp-admin/includes/class-wp-media-list-table.php | 3 +-- wp-includes/version.php | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/wp-admin/includes/class-wp-media-list-table.php b/wp-admin/includes/class-wp-media-list-table.php index 031f306987..b85662611b 100644 --- a/wp-admin/includes/class-wp-media-list-table.php +++ b/wp-admin/includes/class-wp-media-list-table.php @@ -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'], ) ); diff --git a/wp-includes/version.php b/wp-includes/version.php index 85284cd56f..7057d113d2 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -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.