Make WordPress Core


Ignore:
Timestamp:
04/13/2022 02:55:34 AM (4 years ago)
Author:
peterwilsoncc
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-comment-query.php

    r52977 r53169  
    445445        /*
    446446         * Only use the args defined in the query_var_defaults to compute the key,
    447          * but ignore 'fields', which does not affect query results.
     447         * but ignore 'fields', 'update_comment_meta_cache', 'update_comment_post_cache' which does not affect query results.
    448448         */
    449449        $_args = wp_array_slice_assoc( $this->query_vars, array_keys( $this->query_var_defaults ) );
    450         unset( $_args['fields'] );
     450        unset( $_args['fields'], $_args['update_comment_meta_cache'], $_args['update_comment_post_cache'] );
    451451
    452452        $key          = md5( serialize( $_args ) );
Note: See TracChangeset for help on using the changeset viewer.