Cache API: Improve cache key generation in WP_Comment_Query.

Discard the parameters `update_comment_meta_cache` and `update_comment_post_cache` when generating the cache key as neither have an effect on the database query generated.

Props uday17035, spacedmonkey.
Fixes #55460.


Built from https://develop.svn.wordpress.org/trunk@53169


git-svn-id: http://core.svn.wordpress.org/trunk@52758 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Peter Wilson 2022-04-13 02:57:14 +00:00
parent 2ea5eb36fe
commit 4b73e7b87b
2 changed files with 3 additions and 3 deletions

View File

@ -444,10 +444,10 @@ class WP_Comment_Query {
/*
* Only use the args defined in the query_var_defaults to compute the key,
* but ignore 'fields', which does not affect query results.
* but ignore 'fields', 'update_comment_meta_cache', 'update_comment_post_cache' which does not affect query results.
*/
$_args = wp_array_slice_assoc( $this->query_vars, array_keys( $this->query_var_defaults ) );
unset( $_args['fields'] );
unset( $_args['fields'], $_args['update_comment_meta_cache'], $_args['update_comment_post_cache'] );
$key = md5( serialize( $_args ) );
$last_changed = wp_cache_get_last_changed( 'comment' );

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.0-beta1-53168';
$wp_version = '6.0-beta1-53169';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.