Skip to content

Commit d730822

Browse files
committed
Fixed: Duplicate cache meta_keys generated
Fixes #214
1 parent f259c97 commit d730822

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

includes/class-crp-core-query.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,7 +1043,7 @@ public function posts_pre_query( $posts, $query ) {
10431043
// Check the cache if there are any posts saved.
10441044
if ( ! empty( $this->query_args['cache_posts'] ) && ! ( is_preview() || is_admin() || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) ) ) {
10451045

1046-
$meta_key = Cache::get_key( $this->query_args );
1046+
$meta_key = Cache::get_key( $this->input_query_args );
10471047

10481048
$cached_data = Cache::get_cache( $this->source_post->ID, $meta_key );
10491049
if ( ! empty( $cached_data ) ) {
@@ -1106,7 +1106,7 @@ public function the_posts( $posts, $query ) {
11061106

11071107
// Support caching to speed up retrieval.
11081108
if ( ! empty( $this->query_args['cache_posts'] ) && ! $this->in_cache && ! ( is_preview() || is_admin() || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) ) ) {
1109-
$meta_key = Cache::get_key( $this->query_args );
1109+
$meta_key = Cache::get_key( $this->input_query_args );
11101110
$post_ids = wp_list_pluck( $query->posts, 'ID' );
11111111

11121112
Cache::set_cache( $this->source_post->ID, $meta_key, $post_ids );

readme.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ If you enable thumbnails, the plugin will try to find the correct thumbnail in t
168168

169169
* Bug fixes:
170170
* Fixed an issue where shortcode attributes were not properly sanitized.
171+
* Fixed an issue where cache keys were not being generated correctly resulting in duplicate cache keys.
171172

172173
= 4.0.2 =
173174

0 commit comments

Comments
 (0)