From 2a322664b5b10ef2f8efec35a22be81514c20183 Mon Sep 17 00:00:00 2001 From: Andrey Kuvshinov Date: Mon, 1 Sep 2025 12:34:25 +0300 Subject: [PATCH] correct clear block cache --- block-cache-manager.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/block-cache-manager.php b/block-cache-manager.php index 1c61805..3a5f547 100644 --- a/block-cache-manager.php +++ b/block-cache-manager.php @@ -56,7 +56,6 @@ function clear_template_cache ( $template ) { } - /** * Общая функция для сброса кеша на основе условий поста * @@ -66,9 +65,9 @@ function clear_post_cache_based_on_conditions( $post_id, $post ) { // Кеш по типу поста if ($post->post_type == 'profile_article') { - clear_template_cache('template-parts/home/list-items'); clear_template_cache('template-parts/home/main-item'); clear_template_cache('template-parts/home/colon-item'); + clear_template_cache('template-parts/home/list-items'); //всегда в конце тк могут переместиться из предыдущих } elseif ($post->post_type == 'anew' || $post->post_type == 'yellow') { clear_template_cache('template-parts/home/news'); @@ -77,13 +76,15 @@ function clear_post_cache_based_on_conditions( $post_id, $post ) { // Сброс главной $main_item = get_post_meta($post_id, 'main_item', true); if ($main_item === 'true' || $main_item === '1') { - clear_template_cache('template-parts/home/main-item'); + clear_template_cache('template-parts/home/main-item'); + clear_template_cache('template-parts/home/list-items'); } // Сброс колонки $colon_item = get_post_meta($post_id, 'colon_item', true); if ($colon_item === 'true' || $colon_item === '1') { clear_template_cache('template-parts/home/colon-item'); + clear_template_cache('template-parts/home/list-items'); } // Обновляем сигнальный файл