WPBeginner

Beginner's Guide for WordPress

  • Blog
    • Beginners Guide
    • News
    • Opinion
    • Showcase
    • Themes
    • Tutorials
    • WordPress Plugins
  • Start Here
    • How to Start a Blog
    • Create a Website
    • Start an Online Store
    • Best Website Builder
    • Email Marketing
    • WordPress Hosting
    • Business Name Ideas
  • Deals
    • Bluehost Coupon
    • SiteGround Coupon
    • WP Engine Coupon
    • HostGator Coupon
    • Domain.com Coupon
    • Constant Contact
    • View All Deals »
  • Glossary
  • Videos
  • Products
X
☰
Beginner's Guide for WordPress / Start your WordPress Blog in minutes
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
Recommended
WordPress Plugins
View all Guides

WPBeginner» Blog» Plugins» How to Add Hreflang Tags in WordPress

How to Add Hreflang Tags in WordPress

Last updated on April 24th, 2017 by Editorial Staff
235 Shares
Share
Tweet
Share
Pin
Free WordPress Video Tutorials on YouTube by WPBeginner
How to Add Hreflang Tags in WordPress

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="example.com" hreflang="en-us" />
<link rel="alternate" href="example.com/fr/" hreflang="fr-fr" />
<link rel="alternate" href="example.com/pt/" 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.

235 Shares
Share
Tweet
Share
Pin
Popular on WPBeginner Right Now!
  • Revealed: Why Building an Email List is so Important Today (6 Reasons)

    Revealed: Why Building an Email List is so Important Today (6 Reasons)

  • Checklist

    Checklist: 15 Things You MUST DO Before Changing WordPress Themes

  • How to Properly Move Your Blog from WordPress.com to WordPress.org

  • Google Analytics in WordPress

    How to Install Google Analytics in WordPress for Beginners

About the Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi. Trusted by over 1.3 million readers worldwide.

The Ultimate WordPress Toolkit

26 Comments

Leave a Reply
  1. Navneet Siddhartha says:
    Feb 28, 2020 at 8:04 pm

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

    Reply
    • WPBeginner Support says:
      Mar 2, 2020 at 11:13 am

      You’re welcome :)

      Reply
  2. shan ullah says:
    Jan 16, 2019 at 1:42 pm

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

    Reply
    • WPBeginner Support says:
      Jan 17, 2019 at 10:40 am

      Glad you’ll use our content :)

      Reply
  3. Erez says:
    Jan 13, 2019 at 10:53 pm

    you can set up the language on the WordPress setting page.

    Reply
    • WPBeginner Support says:
      Jan 14, 2019 at 2:48 pm

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

      Reply
  4. Nasir says:
    Oct 8, 2018 at 5:06 am

    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?

    Reply
  5. Dani says:
    Aug 18, 2018 at 5:03 am

    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

    Reply
  6. Shyamu says:
    Aug 17, 2018 at 7:14 am

    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?

    Reply
  7. Bhavya says:
    Aug 8, 2018 at 5:08 am

    Hi,

    I am working on a multilingual website. How many lagnuages i can target at once?

    Reply
  8. Mudassar says:
    Aug 2, 2018 at 7:55 am

    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?

    Reply
    • Thomas Greenbank says:
      Aug 2, 2018 at 8:44 pm

      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.

      Reply
  9. didmin says:
    May 28, 2018 at 8:26 pm

    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!

    Reply
    • Sam Jaff says:
      Jul 10, 2018 at 3:34 am

      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.

      Reply
  10. Pitshou Beya says:
    May 16, 2018 at 3:56 am

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

    Reply
  11. Mitesh says:
    Apr 18, 2018 at 11:07 pm

    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

    Reply
  12. Alice Miller says:
    Mar 30, 2018 at 1:10 am

    Hello,

    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

    Reply
  13. Olaniyi says:
    Feb 19, 2018 at 10:21 pm

    Hi, I’m not targeting a particular country, do I still need to implement hreflang?

    Reply
  14. Thomas Greenbank says:
    Dec 2, 2017 at 10:03 pm

    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.
    Thomas.

    Reply
  15. Khemraj says:
    Nov 30, 2017 at 3:42 am

    Hello,
    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 example.com/us, example.com/in etc so to target specific countries do i need to install wordpress in each subdirectory ? ? ?

    Reply
  16. Nick says:
    Jul 19, 2017 at 12:14 am

    I wanna know if my site only one language, did I need to input this Hreflang Tags?

    Reply
    • WPBeginner Support says:
      Jul 19, 2017 at 11:01 am

      Hi Nick,

      No, you don’t need hreflang tags. WordPress automatically adds the default language in the html tag like this:

      <html lang="en-US">

      Reply
  17. Mitch says:
    May 29, 2017 at 11:57 am

    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?

    Reply
  18. amihan says:
    Apr 24, 2017 at 5:08 pm

    what about codes?? nice functions of wordpress are not enought?

    Reply
  19. Rowels Brutte says:
    Apr 24, 2017 at 12:56 pm

    Hello.
    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?

    Reply
    • WPBeginner Support says:
      Apr 24, 2017 at 4:33 pm

      As described in the article you can select them as hreflang in a multilingual plugin or hreflang tags lite plugin.

      Reply

Leave a Reply Cancel 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.

Over 1,320,000+ Readers

Get fresh content from WPBeginner

Featured WordPress Plugin
PushEngage
PushEngage
Increase your website traffic & revenue with push notifications. Learn More »
How to Start a Blog How to Start a Blog
I need help with ...
Starting a
Blog
WordPress
Performance
WordPress
Security
WordPress
SEO
WordPress
Errors
Building an
Online Store
Useful WordPress Guides
    • 7 Best WordPress Backup Plugins Compared (Pros and Cons)
    • How to Fix the Error Establishing a Database Connection in WordPress
    • Why You Need a CDN for your WordPress Blog? [Infographic]
    • 30 Legit Ways to Make Money Online Blogging with WordPress
    • Self Hosted WordPress.org vs. Free WordPress.com [Infograph]
    • Free Recording: WordPress Workshop for Beginners
    • 24 Must Have WordPress Plugins for Business Websites
    • How to Properly Move Your Blog from WordPress.com to WordPress.org
    • 5 Best Contact Form Plugins for WordPress Compared
    • Which is the Best WordPress Popup Plugin? (Comparison)
    • Best WooCommerce Hosting in 2020 (Comparison)
    • How to Fix the Internal Server Error in WordPress
    • How to Install WordPress - Complete WordPress Installation Tutorial
    • Why You Should Start Building an Email List Right Away
    • How to Properly Move WordPress to a New Domain Without Losing SEO
    • How to Choose the Best WordPress Hosting for Your Website
    • How to Choose the Best Blogging Platform (Comparison)
    • WordPress Tutorials - 200+ Step by Step WordPress Tutorials
    • 5 Best WordPress Ecommerce Plugins Compared
    • 5 Best WordPress Membership Plugins (Compared)
    • 7 Best Email Marketing Services for Small Business (2020)
    • How to Choose the Best Domain Registrar (Compared)
    • The Truth About Shared WordPress Web Hosting
    • When Do You Really Need Managed WordPress Hosting?
    • 5 Best Drag and Drop WordPress Page Builders Compared
    • How to Switch from Blogger to WordPress without Losing Google Rankings
    • How to Properly Switch From Wix to WordPress (Step by Step)
    • How to Properly Move from Weebly to WordPress (Step by Step)
    • Do You Really Need a VPS? Best WordPress VPS Hosting Compared
    • How to Properly Move from Squarespace to WordPress
    • How to Register a Domain Name (+ tip to get it for FREE)
    • HostGator Review - An Honest Look at Speed & Uptime (2020)
    • SiteGround Reviews from 4196 Users & Our Experts (2020)
    • Bluehost Review from Real Users + Performance Stats (2020)
    • How Much Does It Really Cost to Build a WordPress Website?
    • How to Create an Email Newsletter the RIGHT WAY (Step by Step)
    • Free Business Name Generator (A.I Powered)
    • How to Create a Free Business Email Address in 5 Minutes (Step by Step)
    • How to Install Google Analytics in WordPress for Beginners
    • How to Move WordPress to a New Host or Server With No Downtime
    • Why is WordPress Free? What are the Costs? What is the Catch?
    • How to Make a Website in 2020 – Step by Step Guide
Deals & Coupons (view all)
Churnly Coupon
Get 30% OFF on Churnly WordPress automated churn-busting plugin.
AccessPress Themes
AccessPress Themes Coupon
Get 15% off on AccessPress Themes collection of premium WordPress themes and plugins.
Featured In
About WPBeginner®

WPBeginner is a free WordPress resource site for Beginners. WPBeginner was founded in July 2009 by Syed Balkhi. The main goal of this site is to provide quality tips, tricks, hacks, and other WordPress resources that allows WordPress beginners to improve their site(s).
Join our team: We are Hiring!

Site Links
  • About Us
  • Contact Us
  • FTC Disclosure
  • Privacy Policy
  • Terms of Service
  • Free Blog Setup
  • Free Business Tools
Our Sites
  • OptinMonster
  • MonsterInsights
  • WPForms
  • SeedProd
  • Nameboy
  • RafflePress
  • Smash Balloon

Copyright © 2009 - 2021 WPBeginner LLC. All Rights Reserved. WPBeginner® is a registered trademark.

Managed by Awesome Motive | WordPress hosting by SiteGround | WordPress CDN by MaxCDN | WordPress Security by Sucuri.