Glossary

What is Hreflang?

February 8, 2026

If you run a multilingual WordPress site, you have probably dealt with hreflang at some point (or at least you should have). Hreflang is an HTML attribute that tells search engines: "This page exists in multiple language versions, and here is where to find each one." Without it, Google treats your German and English pages as separate, unrelated content, or worse, as duplicates competing against each other in search results.

Why Multilingual Sites Need Hreflang Tags

Imagine you have an "About Us" page in English at /en/about/ and its German translation at /de/ueber-uns/. Both pages cover the same topic with very similar structure. From Google's perspective, that can look like duplicate content. The search engine might pick one version and suppress the other, or split ranking signals between both. Neither outcome is what you want.

Hreflang fixes this by explicitly declaring: these two pages are translations of each other. Google then knows to show the English version to English-speaking users and the German version to German-speaking users, without any ranking penalty.

How to Add Hreflang Tags to Your Website

You add link elements to the <head> section of every page that has translations. Each tag points to one language version, and you must include all versions on every page, including a self-referencing tag:

<link rel="alternate" hreflang="en" href="https://example.com/en/about/" />
<link rel="alternate" hreflang="de" href="https://example.com/de/ueber-uns/" />
<link rel="alternate" hreflang="x-default" href="https://example.com/en/about/" />

The x-default tag is the fallback. It tells search engines which version to show when the user's language does not match any of the listed options. Usually you point it at your primary language or a language-selection page.

Hreflang Language and Region Codes Explained

Hreflang uses ISO 639-1 language codes, optionally combined with ISO 3166-1 region codes. Some common ones:

  • en: English, all regions
  • de: German, all regions
  • en-US: English specifically for the US
  • de-AT: German specifically for Austria
  • pt-BR: Portuguese for Brazil (as opposed to Portugal)

A frequent mistake: using uk for British English (the correct code is en-GB) or jp for Japanese (it is ja). These look plausible but are simply wrong, and Google will ignore incorrect codes silently, with no error message, just broken hreflang.

Bidirectional Hreflang: Why Return Links Are Required

This is where most implementations break: hreflang tags must be bidirectional. If your English page declares a German alternate, the German page must also declare the English alternate. If one side is missing, Google may discard the entire hreflang relationship for that page pair. This becomes especially tricky on larger sites where pages get added or removed and the hreflang tags fall out of sync.

HTML, HTTP Headers, or Sitemap: Three Hreflang Methods

Besides HTML link tags, there are two additional methods:

  • HTTP headers: Useful for non-HTML files like PDFs. You set Link headers in the HTTP response with the hreflang values.
  • XML sitemap: You can declare all language versions in your sitemap using the xhtml:link element. This is often the most reliable approach for large sites because it keeps the hreflang data centralized and easier to maintain.

Pick one method and stick with it. Mixing methods is technically allowed but increases the chance of inconsistencies.

Hreflang for WordPress: Plugins and Best Practices

WordPress does not generate hreflang tags on its own. If you use a multilingual plugin like WPML, Polylang, or TranslatePress, these plugins typically handle hreflang output automatically. But "automatically" does not mean "correctly", so you should still verify the output, especially after changing URL structures, adding new languages, or migrating content.

Without a multilingual plugin, you would need to add hreflang tags manually through your theme or via a custom plugin. For most sites, that is unnecessarily error-prone. Use a plugin that handles the complexity for you.

Validate Your Hreflang Setup with InspectWP

InspectWP scans your WordPress pages for hreflang tags and lists every language variant it finds. This lets you verify at a glance whether all expected language versions are declared and whether any return links are missing, without having to dig through the page source yourself.

Check your WordPress site now

InspectWP analyzes your WordPress site for security issues, SEO problems, GDPR compliance, and performance — for free.

Analyze your site free