data codes through eyeglasses

Duplicate <title> Tags with Yoast SEO and Block Themes: Cause and Fix

ยท

If you’re seeing two <title> tags in your page source while running Yoast SEO on a block theme, here’s exactly why it happens and how to fix it.

The problem

Block themes (FSE themes using theme.json) sometimes include this in their functions.php:

add_theme_support( 'title-tag' );

When that line is present, WordPress core hooks _wp_render_title_tag() to wp_head at priority 1 and outputs a <title> tag. Yoast SEO also outputs its own <title> via wp_head. Result: two <title> tags in the page source.

Search engines can behave unpredictably with duplicate title tags, so this is worth fixing properly rather than hoping for the best.

Why it’s confusing to debug

The obvious fix looks like this:

remove_action( 'wp_head', '_wp_render_title_tag', 1 );

Add that to functions.php, reload the page โ€” and both <title> tags are still there. Maddening.

The real culprit is page caching. If you’re running a caching plugin (WP Rocket, W3 Total Cache, LiteSpeed Cache, etc.), the page HTML was captured before your change. You’re looking at stale output. The hook removal is working fine โ€” you’re just not seeing it yet.

The fix

For block/FSE themes, the right answer is to remove add_theme_support( 'title-tag' ) from the theme entirely. With theme.json-based rendering, Yoast SEO owns the <title> output โ€” the theme doesn’t need to claim that responsibility.

Find and delete this from your functions.php:

add_theme_support( 'title-tag' );

If you want belt-and-suspenders protection โ€” useful if you’re building a theme others might use with or without Yoast โ€” you can keep the remove_action as a fallback:

// Prevent WP core from outputting its own title tag.
// Yoast SEO handles this for FSE/block themes.
remove_action( 'wp_head', '_wp_render_title_tag', 1 );

But the cleaner solution is removing the add_theme_support call. Don’t add the problem and then remove it โ€” just don’t add it.

Why TwentyTwentyFive is a useful sanity check

If you’re not sure whether the duplicate is coming from your theme or a deeper Yoast/WordPress interaction, temporarily switch to TwentyTwentyFive. It’s the stock WordPress block theme and doesn’t call add_theme_support( 'title-tag' ).

If the duplicate disappears on TwentyTwentyFive, the issue is in your theme’s functions.php. If it persists, you’re looking at a plugin conflict elsewhere.

Switching themes also has a practical debugging bonus: it typically bypasses your page cache, so you’re seeing fresh rendered output rather than a stale cached copy.

The cache gotcha โ€” don’t skip this

Always purge your page cache after making any changes to hooks in functions.php. This applies to any hook addition or removal โ€” the cache stores rendered HTML, so PHP changes have zero effect until the cache is cleared and pages are regenerated.

The correct sequence every time:

  1. Make the change in functions.php
  2. Save
  3. Purge the page cache
  4. Load the page fresh โ€” incognito or Ctrl+Shift+R to bypass browser cache too
  5. View source and check

Skipping step 3 is the single most common reason a working fix looks broken.

Summary

Symptom / situationAction
Two <title> tags in sourceRemove add_theme_support('title-tag') from theme
Fix appears not to workPurge page cache, then recheck
Can’t tell if it’s theme or pluginSwitch to TwentyTwentyFive to isolate
Building a distributable themeKeep remove_action('wp_head', '_wp_render_title_tag', 1) as a fallback

Leave a Reply