How to add hreflang tags in WordPress (the right way)

Updated July 19, 20266 min read

If your WordPress site exists in more than one language, hreflang tags are how you tell search engines which version to serve which user. Get them right and German visitors land on your German pages; get them wrong and Google either guesses or ignores your annotations entirely. This guide covers what they are, the rules that matter, and the fastest reliable way to add them.

What hreflang actually does

An hreflang annotation is a <link rel="alternate" hreflang="…"> tag in the page <head> that maps a language (and optionally a region) to a URL. A page available in English, German, and French declares all three, so search engines can connect the versions and show the right one in results.

The three rules people get wrong

1. Annotations must be reciprocal

This is the big one. If your English page links to the German page, the German page must link back. One-way (non-reciprocal) hreflang is ignored by Google. In practice, that means every language version of a page carries the same complete set of hreflang tags, including a link to itself.

2. Use valid language and region codes

The value is an ISO 639-1 language code, optionally a hyphen and an ISO 3166-1 region — en, en-GB, pt-BR. Don't invent codes (the UK is en-GB, not en-UK). Keep a language-code reference handy.

3. Always include x-default

Add an x-default entry pointing at your best neutral page (often the homepage or a language selector) for users who match none of your specific versions.

Option A: add hreflang manually

For a small, static set of pages you can hand-code the tags. Use the free hreflang tag generator to produce a correct, reciprocal block, then paste the same block into the <head> of every language version — via your theme's header template or a per-page head-injection plugin. This works, but it's fragile: every new page and every new language multiplies the tags you maintain by hand, and a single missing reciprocal link breaks the set.

Option B: let a plugin handle it

On any real multilingual site, you want hreflang generated automatically. A translation plugin like Gloty emits reciprocal hreflang (with x-default), per-language canonicals, and translated meta for every page — including WooCommerce — with no manual tags to maintain. That's the difference between a one-time setup and an ongoing chore.

Verify it works

However you add them, confirm the result. Load a translated URL in the free hreflang checker to see every tag, whether x-default is present, and whether any codes are duplicated. Then spot-check one of the referenced URLs to confirm it points back — that's your reciprocity test.

Summary

  • hreflang maps language/region to URL so search engines serve the right version.
  • Annotations must be reciprocal, use valid codes, and include x-default.
  • Hand-coding works for tiny sites; a plugin is the sane choice once you have real content.
  • Always verify with a checker after setup.

FAQ

Does WordPress add hreflang tags automatically?
No — core WordPress has no hreflang support. You add them manually or, more reliably, via a multilingual/translation plugin that generates reciprocal hreflang for every page.
Where do hreflang tags go?
In the <head> of every language version of a page. Each version carries the same complete, reciprocal set — including a self-reference and x-default.
Can I use hreflang without a plugin?
Yes, for a small number of pages you can generate the tags and inject them into your header template. It becomes unmanageable as pages and languages grow, which is why most sites use a plugin.

Gloty makes WordPress multilingual automatically — AI translation, hreflang, and clean URLs, stored in your own database.

Try Gloty free
Go multilingual free
Open source · your data stays yours
Start free