Why YOAST output not correct data?
Problem: There’s a web site, who’s contain few SEO bugs, firstly, title tag in the DOM code has different than we use on the YOAST SEO plugin settings block for current page and secondly, canonical link is missing.
Solution: At the start I checked all settings YOAST SEO plugin, who was installed on this site, but everything was fine. I don't supposed that trouble may be in code.
Step 1: So, let's our see header part in the 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>
Ohh! It's has so many mistakes, incredibly! We should remove title, description and keywords. Content of keywords tag especially "pleased" ☺ Further, we should check availability next code at the functions.php and if it absent, add it:
add_theme_support( 'title-tag' );
Step 2. Canonical link may be missing if contain noindex settings for meta name robots. That's exactly our case. But, why after remove the tag from tag canonical links still don't show up. It turns out , problem was here WordPress Settings - Reading - Discourage search engines from indexing this site, this setting was enabled, we should turn of.