From 99df8739cce1a34473ba0697fae1ed4667318e40 Mon Sep 17 00:00:00 2001 From: spacedmonkey Date: Fri, 10 Mar 2023 15:24:01 +0000 Subject: [PATCH] Comments: Prime post caches in WP_Comments_List_Table. In the `WP_Comments_List_Table` class, when the function `get_comments` is called, pass the parameter `update_comment_post_cache` set to true. This primes all the related posts for the displayed comments. This improves performance, as all posts are primed at once. Props spacedmonkey, adarshposimyth. Fixes #57802. git-svn-id: https://develop.svn.wordpress.org/trunk@55513 602fd350-edb4-49c9-b593-d223f7449a82 --- .../includes/class-wp-comments-list-table.php | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/wp-admin/includes/class-wp-comments-list-table.php b/src/wp-admin/includes/class-wp-comments-list-table.php index 8aad24250b..b6bf9c8f19 100644 --- a/src/wp-admin/includes/class-wp-comments-list-table.php +++ b/src/wp-admin/includes/class-wp-comments-list-table.php @@ -140,16 +140,17 @@ class WP_Comments_List_Table extends WP_List_Table { ); $args = array( - 'status' => isset( $status_map[ $comment_status ] ) ? $status_map[ $comment_status ] : $comment_status, - 'search' => $search, - 'user_id' => $user_id, - 'offset' => $start, - 'number' => $number, - 'post_id' => $post_id, - 'type' => $comment_type, - 'orderby' => $orderby, - 'order' => $order, - 'post_type' => $post_type, + 'status' => isset( $status_map[ $comment_status ] ) ? $status_map[ $comment_status ] : $comment_status, + 'search' => $search, + 'user_id' => $user_id, + 'offset' => $start, + 'number' => $number, + 'post_id' => $post_id, + 'type' => $comment_type, + 'orderby' => $orderby, + 'order' => $order, + 'post_type' => $post_type, + 'update_comment_post_cache' => true, ); /**