How to Add Hreflang Tags in WordPress Without plugin

Today you're going to learn how to add Hreflang tag in WordPress without a plugin. We will not use Like  Polylang tag, HREFLANG Tags Lite WordPress Plugin.

Is your blog consisting of a particular region? The hreflang tag will then help your website to improve SEO for those areas that are spoken mainly in those languages.

If you still do not know the exact idea of why the Hreflang tag is necessary,

Then let me give an example,

In India, Hindi is a national language, a large number of people speak Hindi. Many other languages are spoken in India, such as Bengali, Gujarati, Tamil, Telugu.

so you have to be clear about what your blog's target audition is and understand which language they speak.

It is important for search engines to show that your site's language content is not reused and to provide guidelines on the pages that you want to list for alternate languages in different countries.

If you want to show the page is for users in more than one country or region, you can use multiple hreflangs tag on one page also.

So Now you understand that you have to write in which language and which target audience is your right?

Now it comes to know that How are we going to tell Google Search Engine that our blog is in which language and our targeted audience is?

The answer is simple we use the hreflang tag. So here again the question is what does Hreflang mean? Don't worry that I'll explain, let's see ...

Before we going further. must Watch Video for Getting Depth of hreflang tag.


What is hreflang tag?

According to wikipedia, the hreflang tag is the HTML meta element. Hreflang defines the language and possible regional requirements of the text.

WordPress is available in over 60 languages. So you've got to add the Hreflang tag. It tells Google in which language your blog is posted.

I.g.  If one page of your blog post is in A language and the other page is in B language, Google will get that information from your blog. When the hreflang tag has been added.

Below is a sample code,

<link” rel=”alternate” hreflang=”en-us” href=”https://example.com/” />

<link” rel=”alternate” hreflang=”x-default” href=”https://example.com/” />



What is ISO Language and Region Codes

hreflang-tag-from-moz

Image from a blog post by Aleyda Solis

The hreflang tag is a mixture of the code of the language and the code of the country. for example, En-us for English and the United States.

Examples of the Hreflang tag on popular site

Here I give an example of a Very popular website that uses the hreflang tag on their pages.

Facebook :

Language

hreflang Tag

English

<link” rel=”alternate”hreflang=”en” href=”https://www.facebook.com” />

Hindi

<link” rel=”alternate”hreflang=”hi” href=”https://hi-in.facebook.com” />

Portuguese

<link” rel=”alternate”hreflang=”pt” href=”https://pt-br.facebook.com” />

Spanish

<link” rel=”alternate”hreflang=”es” href=”https://es-la.facebook.com” />

 

How to Generate a hreflang tag for your blog/Website

Generate hreflang tag for your blog  here.

Generate-hreflanf-tags
  1. 1
    Enter your Blog Address.
  2. 2
    Select Language of your blog
  3. 3
    Select Your Targeted Country
  4. 4
    If you want to Generate HTML code then Tik only it
  5. 5
    If you want to Generate XML Sitemap then Tik only it
  6. 6
    Finally, Press the Button for getting your code and Copy these code or Save

Where to put the code for hreflang tag

It is easiest to put the hreflang attribute in the HTTP header, or the sitemap.


How to Add Hreflang Tags in WordPress Without WordPress Plugin

I'm going to tell you two methods here that you can use any of them.

They're both fully working. You can test it in the hreflang testing tool after adding it.

Method 1: Add hreflang Tag in WordPress Using Header.php

in this method, We need to edit the WordPress header.php file.

Log into your WordPress dashboard and select Appearance ​ → Theme Editor From this view, you can access your Theme Files.

On the right hand side you will see all the files in your template. Find the file titled, Theme Header or header.php. This is the only file you will need to edit.

In the image below, you will see that I put my generated hreflang Tag under the <Head>.

header-php-add-hreflang-tag

So the 1st method is complete. Your hreflang Tag has been inserted into your blog in a perfect way. kudos!!


Note : If you Don't Find header.php file or any Doubt or confusion about it. If you think the header.php file update will impact my site so that you can skip this process and use Directly the 2nd method.

Method 2: Add Hreflang Tags in WordPress Using Insert Headers and Footers

in this method, We're going to use the Insert Headers and Footers Plugin. Typically we use this plugin to add a script to our header or body field.

If this plugin is working in your WordPress, it's cool, if not, to download it from here.

It's safe and doesn't influence the speed of your blog. Its plugin is also going to be helpful in the future.

SPEED OPTIMIZED WORDPRESS, 20X FASTER WEB HOSTING

Now, Go to the your WordPress dashboard and selectSettings​  → Insert Headers and Footers

You will find like below image. past your hreflang Tag into Scripts in Header Box. 

insert-header-footer-add-hreflang-tag

Boom!!  You're Done.

Bottom line

I hope this post will help you find out How to Add Hreflang Tags in WordPress without Install WordPress plugin.

Both methods will work for you, but remember to use any one of them.

If you liked this post, Please share it because I wrote this post to help you after doing a lot of research and experimenting with myself. 

Subscribe to the GoBloggignz blog for Blogging Tips, SEO Technique and more ... You can find me on Twitter and Facebook, too. Join the VIP Facebook Group.

WHAT OTHERS ARE READING :

Pradip Nalwaya
About Pradip Nalwaya

I love things to do with WordPress, Blogging has been my Passion. In my free time, I enjoy watching Series and Movies Or Reading eBook. | Learner | Founder Of Gobloggingz.com.

7 thoughts on “How to Add Hreflang Tags in WordPress Without plugin”

  1. I want to ask how it will detect URL of all the post. My main website is in English and i write in Hindi and one another regional language.
    Now suppose i have a post on oi.com/href-tag
    and its hindi version oi.com/hi/hreg-tag

    how i will specify this for every published post?

    Reply

Leave a Comment

Pin It on Pinterest