Duplicate Titles with Yoast’s WordPress SEO Plugin

Posted on

This is a ‘problem’ that’s perpetually swirling around the WordPress support forums. Here’s just one example.  I’ll be honest, I haven’t thoroughly combed through the code that hooks into the title and outputs the new “Yoast title”. I will however say, it works perfectly on many, many sites I’ve been using it on.

That being said, for each an every site I’ve initially installed it on, I’ve encountered this issue initially. If you follow the following workflow, baring any wild abnormalities or javascript conflicts, I’m certain you’ll experience similar results.


You are going to want to set default templates. For the various aspects of your site. Aside from setting a default title format to be output for various pages, posts, tags, categories, etc, it resolves a lot of duplication issues.

At the bottom there is a reference for various formatting options. Pick your poison.

Keep in mind, whatever you use between your template tags will be output as well. In my case I generally use “|”. No go check your titles, see how they look now. Keep in mind Yoast has provided both a link to the home page and blog page on this very page. Edit that at will.


I took an additional step and manually customized my title a bit. To do such. You are going to want to locate your themes header.php file open it and locate:

<title><?php echo wp_title("") ?></title>

It’s possble that there could be something other the above between the title tags, but either way, I’ve replaced it with:

if(is_page('home')) { echo bloginfo("description"); echo " | "; echo bloginfo("name"); }
else if(is_home()) { echo bloginfo("name") . " | " . "Blog";}

else { echo wp_title(""); }

A little explanation is in order…

First, we check to see if it’s the home page ‘is_page(‘home’)’. In my case, my home page is actually named “home”.  If it is, we output the “the blog info | the blog description”  These can be found  in the WP backend > settings > general. Note: If yours is something else, replace accordingly.

Then we us the is_home() conditional tag. This is misleading. You would expect it check to see if it’s your HOMEPAGE. What it ACTUALLY does, is check to see if it’s your main blog. Tuck that one away. That one tripped me up more then once before I committed it to memory. Regardless, if that returns true the output is: “The Blog info(name) | Blog”. Note: You can change Blog to whatever you see fit.

Finally , neither of these conditional tags are met output   “wp_title(“”);” and let Yoast do the rest. How’d it work for you?

Tags: , , , , , , , ,

Justin W Hall

Justin W Hall

Mostly a front-end web application developer by day. Sometimes asleep by night.

View Full Profile →

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Your turn. Join the conversation.
Questions? Post 'em bellow or find me on Twitter.
To post code: <pre> <code> Your code here </code></pre>
  • http://www.captainscove.co.uk Captain Walker

    I’ve carefully tried all the suggestions above and here: http://wordpress.org/support/topic/plugin-wordpress-seo-by-yoast-issue-with-duplicate-post-titles-help

    None of these work. I’m experiencing the difficulty when I use the Facebook share icon set up from Jetpack.

    Strangely this http://www.captainscove.co.uk/2012/05/04/assumptions/ – when I hit the Facebook button shows up correctly.

    This one: http://www.captainscove.co.uk/2012/04/28/dummies-to-suffer-even-more/ – also shows up without the duplicate title.

    So now we have individual posts on occasion behaving (not duplicating titles) – but the majority on the same site not behaving.

    I’ve also weeded out all but my Mantra theme – just in case. Even removing Yoast, does not cure the problem. I’ve uninstalled and reinstalled WP3.3.2 and Jetpack.

    I have two other WP sites which haven’t been touched by Yoast (served from the same hosting service), and they have not been affected. I think Yoast need to look into this asap.

    Any other ideas would be most appreciated.

  • http://www.justinwhall.com Justin W. Hall

    I’m not seeing any duplicate titles on those pages. For instance, I see “Assumptions – The Captain’s Cove”

  • http://www.captainscove.co.uk Captain Walker

    “I’m not seeing any duplicate titles on those pages. For instance, I see “Assumptions – The Captain’s Cove””
    Which is correct in relation to my saying, “Strangely this http://www.captainscove.co.uk/2012/05/04/assumptions/ – when I hit the Facebook button shows up correctly.”

    But when I go http://www.captainscove.co.uk/2012/05/05/imagine-this/ – and hit the Facebook share button, I see “Imagine this | | The Captain’s CoveThe Captain’s Cove” as the title in the Facebook dialogue. If that is then posted the title comes out duplicated. I’m certain it’s happening, but only on certain links.

  • http://www.justinwhall.com Justin W. Hall

    Not sure what to say. When I click on your facebook share button on both the pages you’ve posted links to, I see “Page title – The Captain’s Cove”

  • http://www.captainscove.co.uk Captain Walker

    Well that’s very very interesting. It means that different people clicking the share button could get different outcomes. And ..and.. you’ve helped nail the problem!!! But get this! Today when I do the same as before, without any changes to my site, it’s all cured!!

    This is so weird.

  • http://www.justinwhall.com Justin W. Hall

    My guess you were seeing a cached version of you page, weather it was a server side or even client side browser thing – including the FB share pop up.

  • http://batamdinar.com Dinar Emas

    I did change header.php with this as recommended by Yoast but not tick Force Rewrite Title.

    Work for me, take a look here http://batamdinar.com

    Justin, you have a nice and neat theme here. You code by yourself?

  • http://www.justinwhall.com Justin W. Hall

    Glad it helped. And yes, this theme was coded by me, for me :)

  • http://www.islamsys.com/ Imran Khan

    Justin I also have got same problem google webmaster tools says that i have got duplicate title tags within my post for example
    and there are few more with this problem plz help me out with this problem

  • http://www.justinwhall.com Justin W. Hall

    Hey Imran – Your problem isn’t with the Yoast Plugin or even anything to do with wp_title(). In fact, wp_title() is working correctly. Your image attachment is simple generating the same title. It appears that the name of the image is the same as your posts name thus generating duplicate titles. I bet if you rename that file and re-upload it, your problem goes away…

    However, I’d do one better and no-index, no-follow attachment pages. I’m no SEO expert, but I bet there is a setting in Yoast’s plugin to do just that.

  • http://www.islamsys.com Imran

    Thanks a lot Justin you just solved my problem.

  • http://ohguideme.com/ imran aftab

    Justin can i use “canonical tag” to solve this duplicate title tags and links problem?

  • http://www.justinwhall.com Justin W. Hall

    Not really. SEO isn’t really area of expertise but the canonical tag is more to specify the original URL to avoid duplicate content. A URL like so: http://www.mysite.com might display the same (or very much the same) content as something like http://www.mysite.com/?something=something. By specifying the former, the search engine should recognize it’s actually the same size and not penalize you for duplicate content. Or at least that’s my understanding.

  • http://www.resultof.in Admit Card

    No doubt, Yoast’s WordPress SEO Plugin is best SEO Plugin for WordPress till date. It saved me big bucks thanks for writing so much lengthy Tutorial on Yoast’s Plugin Setup. I think by default, it have many drawbacks. To get full output,we must configure it accordingly.

  • Paul ‘Skip’ Brown

    Hi Justin, what about the situation where the source code shows duplicate title tags. Should that be a concern. For example my blog pages have xyz and then further down within the section Yoast creates it also says xyz – I only noticed because I ran it through the validator and it highlighted it as an issue. Is it something to leave alone or is there a solution?

  • Paul ‘Skip’ Brown

    Sorry that should be

    <title> Skipology | xyz </title>

    and then within yoast same thing.