Double sitename in title with WordPress SEO

If you, like me, developed your WP theme before you activate the excellent WordPress SEO by Yoast you might have double sitenames in the title tag after activating the plugin. Something like:

{Sitename}{Page title} | {Sitename}

In your header.php file, the code of the title tag will look similar too:

<title> <?php echo get_bloginfo('name'); ?><?php wp_title('|', true, 'left'); ?></title>

Here is how I fixed this problem with legacy support in mind:

<title> <?php echo (!function_exists('wpseo_replace_vars')) ? get_bloginfo('name') : ''; ?><?php wp_title('|', true, 'left'); ?></title>

Now the title will always look like you intended.

Geef een antwoord

Het e-mailadres wordt niet gepubliceerd.