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
This commit is contained in:
Jonny Harris 2022-09-08 10:15:15 +00:00
parent b7421980bb
commit ad92f3ef9e

View File

@ -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 );