Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
25 Million+
Websites using our plugins
Years of WordPress experience
WordPress tutorials
by experts

How to Add Hreflang Tags in WordPress

Editorial Note: We earn a commission from partner links on WPBeginner. Commissions do not affect our editors' opinions or evaluations. Learn more about Editorial Process.

Do you want to add hreflang tags in your WordPress posts and pages? If you publish content in multiple languages or for different regions, then hreflang tag helps you improve SEO for those regions and languages. In this article, we will show you how to easily add hreflang tags in WordPress without writing a single line of code.

How to add hreflang tags in WordPress

What is hreflang tag?

Hreflang tag allows you to tell search engines which page to show for a particular region and language. You can also use it to define other variations of the same content in different languages.

Here is how a hreflang tag implementation looks like in plain HTML.

<link rel="alternate" href="" hreflang="en-us" />
<link rel="alternate" href="" hreflang="fr-fr" />
<link rel="alternate" href="" hreflang="pt-pt" />

The hreflang tag is a combination of the language code and the region code. For example, en-us for English and the United States, fr-fr for French and France, and so on.

WordPress is available in more than 60 languages, and you can use WordPress in your own language.

Many WordPress site owners target users in different regions and languages. Some do that by creating multilingual websites, while others do that by offering some content in other languages.

Search engines can easily detect the language of a page and automatically match it to the language settings on user’s browser. However, your pages may still be competing with each other in the search results which may affect your site’s SEO.

You can implement hreflang tags to fix that. Let’s see how to easily add hreflang tags in WordPress.

Method 1: Add hreflang Tag in WordPress Using a Multilingual Plugin

The best approach to building a multilingual WordPress site is by using a multilingual plugin. A multilingual WordPress plugin allows you to easily create and manage content in multiple languages using the same WordPress core software.

These plugins will automatically take care of all technical things such as the hreflang tag, so you can focus on creating content.

We recommend using Polylang. It is a free WordPress plugin and comes with a very powerful and easy to use interface to manage multilingual content. For detailed instructions, see our guide on how to how to easily create a multilingual WordPress site.

Adding languages in Polylang

Another popular option is WPML. It is a premium WordPress plugin with an easy to use interface to create multilingual content on your website. For step by step instructions, see our guide on how to create a multilingual WordPress site with WPML.

After you have created some posts or pages in multiple languages, you need to visit them in a new browser window. Right click and select ‘View Page Source’ from your browser menu.

This will open the source code of the post or page. Now you need to look for hreflang tag to verify that it is working properly. You can also use CTRL+F (Command+F) keys to find the hreflang tag.

Method 2: Add Hreflang Tags in WordPress Without Using a Multilingual Plugin

This method is for users who are not using a multilingual plugin to manage translations on their websites.

First thing you need to do is install and activate the HREFLANG Tags Lite plugin. For more details, see our step by step guide on how to install a WordPress plugin.

Upon activation, the plugin will add a new menu item labeled HREFLANG in your WordPress admin menu. Clicking on it will take you to the plugin’s settings page.

hreflang tag plugin settings

Select the post types where you’d like to enable the plugin and then click on the save changes button to save your settings.

Next, you need to edit the post or page where you want to add the hreflang tag. On the post edit screen, you will notice a new metabox labeled HREFLANG tags.

Adding hreflang tags using a plugin

First you need to add the URL of the post that you are currently editing and then select its language. After that you need to click on the plus button to add URLs of other variations of the post and their language.

Once you are done, click on save or update button to save your post.

You can now visit your post in a browser window and view its source code. You will see the hreflang tag added to your post.

We hope this article helped you learn how to easily add hreflang tag to your WordPress site. You may also want to see our step by step WordPress SEO guide for beginners.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us. Here's our editorial process.

Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit - a collection of WordPress related products and resources that every professional should have!

Reader Interactions

33 CommentsLeave a Reply

  1. Syed Balkhi says

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

  2. Jiří Vaněk says

    I’m using PolyLang and now it seems like the PolyLang plugin itself has resolved it. Without any other plugin for hreflang, I have both languages in the source code, Czech and English.

  3. Daniele says

    Hello there,

    I have my main website in English but I want to create an Italian version of it. I just create a subdirectory of it named and installed WordPress on it.

    Do I have to install the plugin described in the second method on my main website or the it one?


    • WPBeginner Support says

      If you did that, you would want to use the second method. We would normally recommend using the first method for most users to be easier to maintain.


  4. Miguel says

    In my specific case I need to implement “hreflang”, or is Not necessary since I’m using completely different domain names ? ?

    • WPBeginner Support says

      While in some cases it can be helpful, if you are using completely different domains then it is not required to use the hreflang tag.


  5. Navneet Siddhartha says

    Thank you so much for writing this article. This really help me a lot…..Thank you..

  6. shan ullah says

    its a real world help i thank full to you for this information i will definitely apply it on my website

    • WPBeginner Support says

      Correct, the hreflang tag is for if you use more than one language on your site.


  7. Nasir says

    Can we use hreflang code on a large site which has been targeting more than 80 regions? does it not increase the website load time?

  8. Dani says

    I already applied for a sitemap but I went through superb tutorail of your about herglang tag tell me now I have to again go for sitemap ? or it will automatically upload it

  9. Shyamu says

    I have been trying to add this hreflang tags in my site. But after adding the tags for a particular targetting country. Its still showing the “en-un” return error. How to solve this in Google Search Console?

  10. Mudassar says

    Hi, I am using English US in my WordPress and my content is also in English but even then Google Webmaster shows this message
    “Your site has no hreflang tags”

    My domain ends with .pk.

    Should i insert the following in header.php of my theme?

    If not, what i should do then?

    • Thomas Greenbank says

      If you are only writing for one language or region you can ignore the “no hreflang tags” message.
      That message will appear automatially, but just ignore it.

  11. didmin says

    I got question

    I am building a Germany website, after add my site into Google Search Console, it is showing me ” no hreftag” error

    My site is only targeting Germany speaking countries, and only in Germany language, so what should I do ?

    Please help me, very urgent!

    • Sam Jaff says

      Yes it will show ” No hreflang ” because you using online single language (Germany) on your website. If you want to target other countries then you have to make settings as mention up on this blog. So it will show in other language to target other country people. But as you said you just want to target German people then don’t consider hreflang and move forward.

  12. Pitshou Beya says

    If I have to use hreflang tags, do I have to translate manually each post? Or just implement the tag on the post

  13. Mitesh says

    Does the default lang=”en-us” have SEO factor that google will consider it to display more to USA visitors and less to other countries?

    Will changing to lang=”en” can benefit targeting

  14. Alice Miller says


    I am not using any specific lang tag for my website. As you told before that WordPress add html lang=”en-US” by default. I checked it’s there in my website. but whenever i am going through any tools there showing it’s missing. Please can you tell me what could be the error

  15. Thomas Greenbank says

    Thanks for posting this.
    If I have a post on a .com site that I want to target to en-au audience, do I need to have an en-us version also? What I mean is, can I have some posts on my site targeting US visitors and others targeting Aus visitors without duplicating them?
    Thanks in anticipation.

  16. Khemraj says

    Suppose I have .com domain and i want to target it to countries like us, uk , canada, australia etc. If i created sub directory like, etc so to target specific countries do i need to install wordpress in each subdirectory ? ? ?

  17. Mitch says

    If you are only targeting one single language is there an SEO benefit for doing a Hreflang Tag or can it just be left unset?

  18. Rowels Brutte says

    An informative post on hreflang attribute.

    I am trying to implement it from a long time.
    But for example, if I want to have 3 different pages for the same language but different country like en-gb, en-us, en-au, how do I proceed?

Leave A Reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.