Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions wp-content/themes/3w-2025/inc/seo-class.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,17 +156,11 @@ 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<!-- SEO Meta Tags -->\n";
echo '<meta name="description" content="' . esc_attr($description) . '">' . "\n";

// 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 '<meta name="description" content="' . esc_attr($description) . '">' . "\n";
}

if (!$rank_math && !empty($keywords)) {
if (!empty($keywords)) {
echo '<meta name="keywords" content="' . esc_attr($keywords) . '">' . "\n";
}

Expand Down
20 changes: 16 additions & 4 deletions wp-content/themes/3w-2025/inc/seo-remediation.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* Purge stale full-page cache once when this remediation version ships.
*/
add_action( 'init', function () {
$cache_version = '2026-11-21-4';
$cache_version = '2026-11-21-5';
if ( get_option( 'threew_seo_remediation_cache_version' ) === $cache_version ) {
return;
}
Expand Down Expand Up @@ -263,9 +263,21 @@ 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 );
/**
* Keep Rank Math from printing a second <meta name="description">.
*
* The theme already emits one from the live excerpt, which the guides rewrite
* above. Rank Math's copy comes from stored post meta on the guides (the stale
* "Discover the 2025 price..." text) and from thin auto-generated copy
* elsewhere, so leaving it in place only gives Google a worse option to pick.
*
* @return string
*/
function threew_2025_suppress_rank_math_description() {
return '';
}

add_filter( 'rank_math/frontend/description', 'threew_2025_suppress_rank_math_description', 99 );

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 );
Expand Down
Loading