Why is Yoast SEO outputting incorrect data?
This happened on a client project. The Yoast SEO settings looked correct, but the front end told a different story — the wrong title was rendering and the canonical link was nowhere to be found. The root cause turned out to be in the theme code, not the plugin.
Problem: A website had a few SEO issues: the title tag in the DOM differed from what was configured in the Yoast SEO plugin settings for that page, and the canonical link was missing.
Solution: I started by checking all the Yoast SEO settings, which looked correct. I didn't expect the issue to be in the code itself.
Step 1. Let's look at the header section in the theme code:
<head>
...
<title><?php bloginfo( 'name' ); ?></title>
<meta name="description" content="<?php bloginfo( 'description' ); ?>">
<meta name="keywords" content="lorem, ipsum">
<meta name="robots" content="noindex,nofollow">
...
</head>
There are quite a few problems here. The hardcoded <title>, <meta description>, and <meta keywords> tags all need to go — Yoast manages these automatically. The keywords tag content was particularly "creative". We also need to make sure the following line is present in functions.php:
add_theme_support( 'title-tag' );
Step 2. A canonical link can disappear when the meta robots tag includes a noindex directive. That was exactly the case here. But even after removing the noindex tag, the canonical link still didn't show up. It turned out the culprit was WordPress Settings → Reading → Discourage search engines from indexing this site — that option was enabled. Turning it off resolved the issue.
NOTE: Yoast SEO manages the <title>, meta description, canonical, and robots tags automatically — but only if add_theme_support( 'title-tag' ) is declared in functions.php and no other plugin or theme code outputs conflicting tags. If you see duplicate or incorrect tags, the first thing to check is hardcoded meta output in the theme's header.php.