Posts, Post Types: Call update_post_author_caches function in WP_Posts_List_Table class.

Call the `update_post_author_caches` function in the `WP_Posts_List_Table` class to prime post author caches in a single database request.

Props spacedmonkey, thakkarhardik, desrosj. 
Fixes #56100.
Built from https://develop.svn.wordpress.org/trunk@54099


git-svn-id: http://core.svn.wordpress.org/trunk@53658 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
spacedmonkey 2022-09-08 10:17:12 +00:00
parent 6d882a5dd9
commit 6542de4220
2 changed files with 4 additions and 1 deletions

View File

@ -790,6 +790,7 @@ class WP_Posts_List_Table extends WP_List_Table {
if ( post_type_supports( $post_type, 'comments' ) ) { if ( post_type_supports( $post_type, 'comments' ) ) {
$this->comment_pending_count = get_pending_comments_num( $post_ids ); $this->comment_pending_count = get_pending_comments_num( $post_ids );
} }
update_post_author_caches( $posts );
foreach ( $posts as $post ) { foreach ( $posts as $post ) {
$this->single_row( $post, $level ); $this->single_row( $post, $level );
@ -885,6 +886,8 @@ class WP_Posts_List_Table extends WP_List_Table {
$ids = array_keys( $to_display ); $ids = array_keys( $to_display );
_prime_post_caches( $ids ); _prime_post_caches( $ids );
$_posts = array_map( 'get_post', $ids );
update_post_author_caches( $_posts );
if ( ! isset( $GLOBALS['post'] ) ) { if ( ! isset( $GLOBALS['post'] ) ) {
$GLOBALS['post'] = reset( $ids ); $GLOBALS['post'] = reset( $ids );

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.1-alpha-54098'; $wp_version = '6.1-alpha-54099';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.