From 39e6d6d3488c5d07dc0df27a34df15b995f8edfe Mon Sep 17 00:00:00 2001 From: spacedmonkey Date: Fri, 10 Mar 2023 15:26:22 +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. Built from https://develop.svn.wordpress.org/trunk@55513 git-svn-id: http://core.svn.wordpress.org/trunk@55045 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- .../includes/class-wp-comments-list-table.php | 21 ++++++++++--------- wp-includes/version.php | 2 +- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/wp-admin/includes/class-wp-comments-list-table.php b/wp-admin/includes/class-wp-comments-list-table.php index 8aad24250b..b6bf9c8f19 100644 --- a/wp-admin/includes/class-wp-comments-list-table.php +++ b/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, ); /** diff --git a/wp-includes/version.php b/wp-includes/version.php index 5fe8674bd1..2c60ba15c3 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.3-alpha-55512'; +$wp_version = '6.3-alpha-55513'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.