Hreflang for WordPress: The Complete Setup Guide

You've built a WordPress site with an English version and a Spanish version of the same pages. Then you notice Google keeps showing the English page to Spanish searchers, or indexing both versions as if they were duplicate content competing against each other. That's almost always a missing-hreflang problem, not a translation problem.

Hreflang is the tag that tells search engines "this page has a version in another language or for another region — here's where to find it." WordPress doesn't add this on its own, which is why sites with perfectly good translations still lose traffic to a mismatched search result.

Quick Answer

To add hreflang on WordPress, use a multilingual plugin like WPML, Polylang, or TranslatePress to generate the tags automatically, or add <link rel="alternate" hreflang="..."> tags manually via functions.php for a small, fixed set of language pages. Every language version must link to every other version, including itself, or Google will disregard the whole set.

What is hreflang, and why WordPress needs help with it

Hreflang is an HTML attribute that tells search engines which language and, optionally, which region a page is meant for, and points to the equivalent page in every other language you've published. It doesn't translate anything and doesn't affect rankings directly — it just routes the right page to the right searcher.

The practical takeaway: hreflang isn't a WordPress feature that's hidden in settings somewhere — it's a relationship between pages that something has to explicitly define, whether that's a plugin doing it for you or code you add yourself.

Why hreflang matters for a WordPress site

Skipping hreflang on a multilingual WordPress site has consequences that show up slowly, which is part of why it's so often missed:

📊 Quick stat The most frequently reported hreflang issue in Google Search Console isn't a wrong language code — it's a missing return tag, where Page A links to Page B but Page B never links back, which is enough on its own to make Google ignore the pair.

Step-by-step: adding hreflang on WordPress

  1. Decide your language/region structure first. Subdirectories (/es/), subdomains (es.site.com), or separate ccTLDs all work with hreflang — pick one before generating any tags.
  2. Confirm each page actually has a translated counterpart. Hreflang should only point to pages that genuinely exist and are genuinely equivalent in content, not a homepage substituting for a missing translation.
  3. If you're running a multilingual plugin (WPML, Polylang, TranslatePress), turn on its hreflang output. These plugins already track which posts are translations of each other, so the tags generate automatically once translation pairs are set up.
  4. If you're not using a plugin, generate the tags manually. List every language version's URL, including the current page's own URL as a self-reference, and produce one <link rel="alternate" hreflang="..."> line per version.
  5. Add the manual tags via functions.php or a header/SEO plugin field. Hook into wp_head so the tags are injected into every relevant page's <head> automatically rather than pasted in one page at a time.
  6. Add an x-default tag if you have a language-neutral fallback. Point it at your default locale or a language-selector page so unmatched visitors have somewhere sensible to land.
  7. Validate the full set on a live page. Check that every version links to every other version, that codes are correctly formatted, and that there are no broken or redirecting URLs in the set.
Try the Rebrixe Hreflang Generator — free Enter your language versions, get a validated, ready-to-paste hreflang tag set.
Generate Hreflang Tags →

Common hreflang mistakes on WordPress

1. Missing return tags

Page A points to Page B, but Page B was published without pointing back to Page A. Google treats this as an unconfirmed relationship and typically discards the entire hreflang set for both pages.

2. Forgetting the self-referencing tag

Every page in the set needs to include a hreflang tag pointing to itself, not just to the other versions — a plugin will usually handle this automatically, but manually written tags often skip it.

3. Using the wrong language or region code

en-UK instead of the correct en-GB is a common WordPress typo that silently breaks a regional pair, since the code has to match the ISO standard exactly to be recognized.

4. Pointing to redirecting or non-canonical URLs

If a hreflang tag points to a URL that redirects, has a different canonical tag, or returns a noindex, search engines may disregard that entry entirely instead of following the redirect.

5. Caching plugins serving stale hreflang tags

A page cache generated before a new translation was added can keep serving an outdated hreflang set — clearing the cache after translation changes is easy to forget.

💡 Pro tip After any content or URL change on a translated page, re-check the full hreflang set for that page group, not just the page you edited — a single broken link anywhere in the set can undermine the rest of it.

Real-world examples

How different WordPress setups typically implement hreflang in practice:

WPML multilingual site
Plugin-managed tags
Automatic
Hreflang generates itself once posts are linked as translations in the plugin's translation manager.
Two-language blog
Manual functions.php hook
One-time code
A short snippet hooked into wp_head prints the two-way hreflang pair for each post's English and Spanish versions.
Regional pricing pages
en-US / en-GB / en-AU
Same language, different regions
Identical English copy across three region codes, distinguished purely by hreflang so each market sees its own pricing page.
WordPress multisite network
Cross-site hreflang
One language per site
Each site in the network represents one locale, with hreflang tags linking equivalent pages across the separate site URLs.

In every case, the underlying rule stays the same: every version of a page has to know about, and correctly link to, every other version.

Hreflang methods for WordPress compared

A look at the main ways to implement hreflang on a WordPress site, and where each one makes sense.

Method Setup effort Scales with content Best for
Multilingual plugin (WPML, Polylang) Moderate, one-time config Automatic on every new post Sites regularly publishing in multiple languages
Manual functions.php hook Requires basic code editing Needs updates as pages are added A small, fixed number of language pages
Standalone hreflang generator Low, form-based Manual re-run per page group One-off pages or sites without a plugin
XML sitemap hreflang Higher, needs sitemap control Centralized for the whole site Large sites that prefer sitemap-based signals over head tags

Generate your hreflang tags right now — free

The Rebrixe Hreflang Generator builds a clean, validated set of hreflang tags for as many language and region versions as you need, including the self-reference and an optional x-default. No account, no watermark — just fill in your URLs and copy the result.

Free Hreflang Tag Generator Add your language versions, copy the ready-to-paste tags.
Open Hreflang Generator →

Frequently asked questions

No. A plugin like WPML, Polylang, or TranslatePress will generate hreflang automatically because it already knows which pages are translations of each other, but a site with only a couple of language versions can add the tags manually through functions.php or a generator without installing a full multilingual plugin.
They belong inside the <head> section of every language version of a page, either as <link> elements or as an HTTP header, and every version must list every other version, including itself.
x-default marks the page shown to visitors whose language doesn't match any of your listed versions, usually a language selector or your default locale. It's optional, but sites without one often see search engines guess incorrectly for unmatched languages.
Yes. Broken hreflang doesn't get your site penalized, but Google typically ignores the entire hreflang set on a page when it detects errors like missing return links, so the wrong pages keep showing up for the wrong languages exactly as if you had no hreflang at all.
Yes, and it's one of the more common setups: each site in the network handles one language or region, and hreflang tags cross-link between the individual sites' URLs the same way they would across separate domains.
No. Core WordPress has no built-in concept of translated page relationships, so hreflang only appears if a multilingual plugin, a theme, or manually added code puts it there.
View the page source or use a hreflang testing tool to confirm the tags are present in the head, then check Google Search Console's international-targeting reports and crawl a page with a site auditor to catch missing return tags across the set.
No. Hreflang only matters when at least two versions of the same page exist for different languages or regions — a single-language site has nothing for it to point between.

Generate your hreflang tags in seconds

The Rebrixe Hreflang Generator builds a clean, validated tag set for every language and region version of your page — no account, no watermark, just a ready-to-paste code block.

Launch the Hreflang Generator →
← Back to blogs