From a33d9bf8c101c1f2091dcf3305365cf247fe4efe Mon Sep 17 00:00:00 2001 From: Hermes Agent Date: Sun, 22 Nov 2026 18:10:15 -0800 Subject: [PATCH] Emit one meta description, not two The theme printed its own description and Rank Math printed a second from stored post meta. Google picks between them, and on both BRABUS guides the stored copy is the old 'Discover the 2025 price...' text, so the price-led rewrite only won half the time. Theme now defers to Rank Math when it is active, and the guides feed their copy through rank_math/frontend/description. --- wp-content/themes/3w-2025/inc/seo-class.php | 10 ++++++++-- wp-content/themes/3w-2025/inc/seo-remediation.php | 6 +++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/wp-content/themes/3w-2025/inc/seo-class.php b/wp-content/themes/3w-2025/inc/seo-class.php index 3268492..88c7069 100644 --- a/wp-content/themes/3w-2025/inc/seo-class.php +++ b/wp-content/themes/3w-2025/inc/seo-class.php @@ -156,11 +156,17 @@ private function rank_math_active() { public function output_meta_tags() { $description = $this->get_meta_description(); $keywords = $this->get_meta_keywords(); + $rank_math = $this->rank_math_active(); echo "\n\n"; - echo '' . "\n"; - if (!empty($keywords)) { + // Rank Math emits its own description; a second tag lets Google pick the + // stale stored one, so only one emitter is allowed to run. + if (!$rank_math) { + echo '' . "\n"; + } + + if (!$rank_math && !empty($keywords)) { echo '' . "\n"; } diff --git a/wp-content/themes/3w-2025/inc/seo-remediation.php b/wp-content/themes/3w-2025/inc/seo-remediation.php index 4961681..6b93d26 100644 --- a/wp-content/themes/3w-2025/inc/seo-remediation.php +++ b/wp-content/themes/3w-2025/inc/seo-remediation.php @@ -13,7 +13,7 @@ * Purge stale full-page cache once when this remediation version ships. */ add_action( 'init', function () { - $cache_version = '2026-11-21-3'; + $cache_version = '2026-11-21-4'; if ( get_option( 'threew_seo_remediation_cache_version' ) === $cache_version ) { return; } @@ -263,6 +263,10 @@ function threew_2025_filter_guide_social_description( $content ) { return isset( $map[ $slug ] ) ? $map[ $slug ]['description'] : $content; } +// Rank Math resolves the meta description from stored post meta, which still +// carries the pre-remediation copy. This runs on its final-value filter. +add_filter( 'rank_math/frontend/description', 'threew_2025_filter_guide_social_description', 20 ); + add_filter( 'rank_math/opengraph/facebook/og_title', 'threew_2025_filter_guide_social_title', 20 ); add_filter( 'rank_math/opengraph/twitter/twitter_title', 'threew_2025_filter_guide_social_title', 20 ); add_filter( 'rank_math/opengraph/facebook/og_description', 'threew_2025_filter_guide_social_description', 20 );