Query: Improve WP_Query's cache key generation for taxonomy queries.

Modify how `WP_Query` determines whether a database query contains a taxonomy component and accounts for term changes when generating the cache key. This presents a stale cache been used under some circumstances.

Props Chouby, costdev, peterwilsoncc.
See #22176.



git-svn-id: https://develop.svn.wordpress.org/trunk@54111 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Peter Wilson
2022-09-09 02:04:18 +00:00
parent 42d3773de9
commit 48f17267fb
2 changed files with 92 additions and 1 deletions
+1 -1
View File
@@ -3094,7 +3094,7 @@ class WP_Query {
$key = md5( serialize( $cache_args ) . $new_request );
$last_changed = wp_cache_get_last_changed( 'posts' );
if ( ! empty( $this->tax_query->queried_terms ) ) {
if ( ! empty( $this->tax_query->queries ) ) {
$last_changed .= wp_cache_get_last_changed( 'terms' );
}