Setting alternate hreflang in WordPress

UPDATE 2013-05-03:
After writing this I found out my approach was incorrect. I have since removed the code as it was not useful.
Dan’s team was kind enough to point me to Virgin Australia‘s site. If you inspect the source and search for hreflang, you’ll see how it should be done.
After seeing the excellent talk by Dan Petrovic at the Melbourne WordCamp, I went to find out more about the <link rel=”alternate” hreflang=”en-AU” href=”” />. He has an article describing it. Essentially if you have multiple sites that have similar content (but not exactly the same) then you can instruct google that the sites serve different regions by using the rel=alternate hreflang=”en=gb” options for the link tag.
A common scenario that you might find this useful would be in online stores where there is a different store for each country.
eg. for site you want a <link> tag like this:
<link rel=”alternate” hreflang=”en-AU” href=”” />
and for you might want a tag like this:
<link rel=”alternate” hreflang=”en-US” href=”” />
and you want to remove the rel=”canonical” option too.
I couldn’t find a plugin that would implement this in WordPress so I wrote one and put it up on github. Yoast does not have an option for this as far as I can tell.
At some point I might put it up on too if it seems like there is interest in it.


  1. I’ve been looking for plugin to help me implement rel=”alternate” hreflang markup. May i ask what was incorrect with your plugins, your description sounds about correct? Any plan to put ti back up in corrected?

  2. That’s a shame. I’m currently looking at a way of adding rel=”alternate using custom fields. Never coded wordpress before, nor am i a coder, so its a nice learning curve! Getting there though.

  3. Hi jason,
    Did you ever find a solution to this or do you know of any plugins that do it?

  4. I use Add Meta Tags plugin to fill in the hreflang entries per post. Since I use Yoast, I don’t use the description and title offered by Add Meta Tags, just their Full Meta Tags field for entering hreflang entries

Leave a comment

Your email address will not be published. Required fields are marked *