From ad92f3ef9ecd5d702c19450d173998fc8c947905 Mon Sep 17 00:00:00 2001 From: Jonny Harris Date: Thu, 8 Sep 2022 10:15:15 +0000 Subject: [PATCH] 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. git-svn-id: https://develop.svn.wordpress.org/trunk@54099 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/class-wp-posts-list-table.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/wp-admin/includes/class-wp-posts-list-table.php b/src/wp-admin/includes/class-wp-posts-list-table.php index 4e7dad18c7..a3fcf9ba01 100644 --- a/src/wp-admin/includes/class-wp-posts-list-table.php +++ b/src/wp-admin/includes/class-wp-posts-list-table.php @@ -790,6 +790,7 @@ class WP_Posts_List_Table extends WP_List_Table { if ( post_type_supports( $post_type, 'comments' ) ) { $this->comment_pending_count = get_pending_comments_num( $post_ids ); } + update_post_author_caches( $posts ); foreach ( $posts as $post ) { $this->single_row( $post, $level ); @@ -885,6 +886,8 @@ class WP_Posts_List_Table extends WP_List_Table { $ids = array_keys( $to_display ); _prime_post_caches( $ids ); + $_posts = array_map( 'get_post', $ids ); + update_post_author_caches( $_posts ); if ( ! isset( $GLOBALS['post'] ) ) { $GLOBALS['post'] = reset( $ids );