From 276d3b34ca0d44bfd82958d29554b45124642f25 Mon Sep 17 00:00:00 2001 From: Peter Wilson Date: Mon, 25 Jul 2022 02:53:13 +0000 Subject: [PATCH] REST API: Prime post caches in comments endpoint. Prevent each call to `get_post()` triggering a seperate database query by priming the cache of each comment's post in the REST API's comments endpoint. Props spacedmonkey, timothyblynjacobs. Fixes #56272. Built from https://develop.svn.wordpress.org/trunk@53772 git-svn-id: http://core.svn.wordpress.org/trunk@53331 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- .../rest-api/endpoints/class-wp-rest-comments-controller.php | 2 ++ wp-includes/version.php | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php index de2f6cc4eb..42919b7dc2 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php +++ b/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php @@ -244,6 +244,8 @@ class WP_REST_Comments_Controller extends WP_REST_Controller { $prepared_args['no_found_rows'] = false; + $prepared_args['update_comment_post_cache'] = true; + $prepared_args['date_query'] = array(); // Set before into date query. Date query must be specified as an array of an array. diff --git a/wp-includes/version.php b/wp-includes/version.php index bfd72937cd..5836e05927 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.1-alpha-53771'; +$wp_version = '6.1-alpha-53772'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.