From 4429878d547f308d58b556d151679f6ccfd35d86 Mon Sep 17 00:00:00 2001 From: Leo Germani Date: Thu, 18 Jan 2024 18:39:01 -0300 Subject: [PATCH] fix the cache key to properly use the dynamic post ID --- includes/classes/DistributorPost.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/includes/classes/DistributorPost.php b/includes/classes/DistributorPost.php index 96e965704..1db784c82 100644 --- a/includes/classes/DistributorPost.php +++ b/includes/classes/DistributorPost.php @@ -666,7 +666,9 @@ protected function parse_media_blocks() { $found = false; // Note: changes to the cache key or group should be reflected in `includes/settings.php` - $media = wp_cache_get( 'dt_media::{$post_id}', 'dt::post', false, $found ); + $cache_key = "dt_media::{$this->post->ID}"; + $cache_group = 'dt::post'; + $media = wp_cache_get( $cache_key, $cache_group, false, $found ); if ( ! $found ) { // Parse blocks to determine attached media. @@ -679,7 +681,7 @@ protected function parse_media_blocks() { } // Only the IDs are cached to keep the cache size down. - wp_cache_set( 'dt_media::{$post_id}', $media, 'dt::post' ); + wp_cache_set( $cache_key, $media, $cache_group ); } /*