
You’ve built a multilingual WordPress site — or you’re planning to. Your content exists in English, Spanish, French, or a dozen other languages. But there’s a problem you might not even know you have: without hreflang tags, Google doesn’t know which version of your content to show which audience.
The result? Your French content shows up for Spanish speakers. Your UK pages compete against your US pages for the same rankings. Your German audience lands on your English homepage and immediately bounces. All of that work creating localized content — wasted, because search engines couldn’t route the right visitor to the right page.
Hreflang tags fix this. And in this guide, you’ll learn exactly how to implement them correctly in WordPress — from the easiest plugin-based methods to manual implementation for developers — plus how to test that they’re working and avoid the errors that affect over 75% of multilingual sites.
Hreflang is an HTML attribute — introduced by Google in 2011 — that tells search engines two things about a page:
When Google encounters a hreflang tag, it uses that information to show the right language version of your content to the right user. A visitor searching from France with French browser settings gets your French page. A visitor searching from Mexico gets your Spanish (Latin America) page. A visitor in Australia gets your en-AU version.
Without hreflang, Google has to guess — and it frequently guesses wrong.
What a hreflang tag actually looks like in HTML:
html
<link rel=”alternate“ hreflang=”en-us“ href=”https://example.com/“ />
<link rel=”alternate“ hreflang=”fr-fr“ href=”https://example.com/fr/“ />
<link rel=”alternate“ hreflang=”de“ href=”https://example.com/de/“ />
<link rel=”alternate“ hreflang=”x-default“ href=”https://example.com/“ />
Breaking down the anatomy:
These tags go inside the <head> section of every page. They can also be placed in your XML sitemap — we’ll cover both methods.
Both competitor guides on this topic touch on hreflang basics but skip the deeper strategic picture. Here’s what’s actually at stake:
This is the most critical reason for most WordPress sites. If you have a UK English page and a US English page with very similar content, Google may flag them as duplicates and penalize both — or simply rank one and ignore the other, which may not be the version you want ranking in each market.
Hreflang tells Google: “These pages aren’t duplicates — they’re intentional language/region variants of the same content.” Google then treats them as a cluster, allowing each version to rank in its own target market without competing against each other.
As Google’s Gary Illyes has explained, pages in a hreflang cluster “should be able to use each other’s ranking signals” — meaning good links and authority earned by your English page can help your French page too.
Studies consistently show that users prefer content in their native language. When a French speaker lands on your English page because Google didn’t know a French version existed, they bounce immediately. That bounce signal hurts your rankings. Hreflang prevents the mismatch.
Without hreflang, your localized pages are invisible to the audiences they’re meant for. A Spanish page with no hreflang tag won’t reliably appear in searches from Spain or Mexico — Google doesn’t know it’s intended for Spanish speakers.
In 2026, AI-powered search features (Google AI Overviews, Bing Copilot) increasingly pull from structured, well-organized content. Sites with proper hreflang implementation give AI systems clear language and region signals — making it easier for those systems to surface the correct language version in generated answers for international queries.
Before implementing hreflang, you need to understand the code format — because using the wrong codes is one of the most common errors, and Google will silently ignore incorrectly formatted tags.
The format is: language-COUNTRY (language code is required, country code is optional)
Language codes use ISO 639-1 two-letter codes:
| Language | Code |
|---|---|
| English | en |
| French | fr |
| German | de |
| Spanish | es |
| Portuguese | pt |
| Italian | it |
| Japanese | ja |
| Chinese (Simplified) | zh |
| Arabic | ar |
| Dutch | nl |
| Russian | ru |
| Korean | ko |
Country codes use ISO 3166-1 Alpha-2 codes:
| Country | Code | Common Mistake |
|---|---|---|
| United States | US | — |
| United Kingdom | GB | ❌ “UK” is wrong — must be “GB” |
| Canada | CA | — |
| Australia | AU | — |
| France | FR | — |
| Germany | DE | — |
| Spain | ES | — |
| Mexico | MX | — |
| Brazil | BR | — |
| China | CN | — |
| Japan | JP | — |
Common code combinations for multilingual WordPress sites:
| Version | Hreflang Code | Example Tag |
|---|---|---|
| Generic English | en | hreflang="en" |
| US English | en-US | hreflang="en-US" |
| UK English | en-GB | hreflang="en-GB" (NOT en-UK) |
| Canadian English | en-CA | hreflang="en-CA" |
| Australian English | en-AU | hreflang="en-AU" |
| French (France) | fr-FR | hreflang="fr-FR" |
| French (Canada) | fr-CA | hreflang="fr-CA" |
| Spanish (Spain) | es-ES | hreflang="es-ES" |
| Spanish (Mexico) | es-MX | hreflang="es-MX" |
| Spanish (Latin America generic) | es | hreflang="es" |
| Portuguese (Brazil) | pt-BR | hreflang="pt-BR" |
| Portuguese (Portugal) | pt-PT | hreflang="pt-PT" |
| Chinese (Simplified, China) | zh-CN | hreflang="zh-CN" |
| Chinese (Traditional, Taiwan) | zh-TW | hreflang="zh-TW" |
| Default (no match) | x-default | hreflang="x-default" |
Critical: Country codes are NOT always what you’d expect. The UK is GB, not UK. Latin America has no single code — use country-specific codes (es-MX, es-AR, es-CO) or the generic es for unspecified Spanish. Never use regional codes like eu (that’s Basque language, not the European Union), la (that’s Laotian), or en-us-gb (invalid — one tag per country).
Before adding hreflang tags, you need to decide how to structure your multilingual URLs. There are three valid approaches, each with different SEO implications:
https://example.com/ (English – default)
https://example.com/fr/ (French)
https://example.com/de/ (German)
https://example.com/es/ (Spanish)
Pros: All language versions benefit from your main domain’s authority. Easiest to set up with WordPress plugins. Most commonly recommended by Google.
Cons: Less geographic targeting signal than ccTLDs.
https://example.com (English – default)
https://fr.example.com (French)
https://de.example.com (German)
https://es.example.com (Spanish)
Pros: Each subdomain can be geotargeted separately in Google Search Console. More flexible hosting options.
Cons: Each subdomain starts with zero domain authority and must build it independently. More complex to set up.
https://example.com (English – default)
https://example.fr (French)
https://example.de (German)
https://example.es (Spanish)
Pros: Strongest geographic targeting signal. Users see local domain which builds trust.
Cons: Most expensive (buying multiple domains). Each domain builds authority independently. Most complex to manage.
Our recommendation for WordPress sites: Subdirectories are the right choice for the vast majority of multilingual WordPress sites. They’re easier to set up with plugins, maintain shared domain authority, and Google handles them well. Use ccTLDs only if you have the budget, technical resources, and strong business reason for separate national domains.
The easiest and most reliable way to add hreflang tags to WordPress is through a translation plugin. These plugins handle both the content translation and the technical hreflang implementation automatically.
Polylang is one of the most widely used multilingual plugins for WordPress, with over 800,000 active installations. The free version handles hreflang tags automatically for sites using subdirectories or subdomains.
Setting up Polylang:
What Polylang does automatically:
After setup — translating your content:
For every post or page, Polylang adds a “Translations” meta box in the editor. Click the “+” next to each language to create a linked translation. Polylang then automatically generates the correct hreflang relationship between the original and translated versions.
Polylang Pro ($99/year) adds: WooCommerce compatibility, custom post type translation, duplicate content for pages with similar layouts, and priority support.
WPML is the market-leading premium multilingual plugin used by over 1 million WordPress sites. It’s more powerful than Polylang but costs $39–$199/year.
WPML plans:
Setting up WPML:
What WPML does with hreflang:
WPML automatically generates hreflang tags in three places:
For WooCommerce stores, WPML also handles hreflang on product pages, category pages, and checkout pages — a significant advantage over free options.
TranslatePress takes a unique approach — you translate your content visually, by clicking directly on elements of your live site in the front-end editor. This makes it particularly beginner-friendly.
Setting up TranslatePress:
Hreflang with TranslatePress:
TranslatePress pricing:
If you already use Rank Math or Yoast SEO for your SEO, here’s how hreflang integrates with each:
This is the combination we recommend most frequently at WPDepend for multilingual WordPress sites. Both plugins are free, they integrate seamlessly, and the result is comprehensive hreflang coverage.
Setup:
What happens automatically:
Verify it’s working:
xml
<url>
<loc>https://example.com/post-name/</loc>
<xhtml:link rel=”alternate“ hreflang=”en“ href=”https://example.com/post-name/“/>
<xhtml:link rel=”alternate“ hreflang=”fr“ href=”https://example.com/fr/post-name/“/>
</url>
Yoast SEO Free does not add hreflang tags on its own. Yoast SEO Premium does — but only when combined with a compatible multilingual plugin.
What Yoast SEO Premium adds ($99/year):
Setup with Polylang:
Important note: Yoast Free does not output hreflang tags. If you’re using Yoast Free, you need either Polylang (which adds head hreflang tags independently) or to upgrade to Yoast Premium for sitemap-level hreflang. Rank Math Free + Polylang achieves the same result at zero cost.
What if you’ve already built separate language versions of your site — perhaps on separate domains or subdomains, or built by different teams — and you don’t use a translation plugin? You can add hreflang relationships manually using a dedicated hreflang plugin.
When to use this: Your site has separate language versions that already exist (e.g., example.com and example.de), but no multilingual plugin connecting them.
Setup:
The limitation: This works but is manual — you need to create individual rules for every page on every language version of your site. For a 50-page site with 3 languages, that’s 150 rules to create and maintain. For larger sites, this approach becomes unmanageable. Use a proper translation plugin instead.
For developers managing complex multilingual setups, you can add hreflang directly to your XML sitemap. This is one of Google’s officially supported implementation methods and has the advantage of centralized management — all your hreflang data is in one file rather than spread across every page’s <head>.
The XML sitemap hreflang format:
xml
<?xml version=”1.0″ encoding=”UTF-8″?>
<urlset xmlns=”http://www.sitemaps.org/schemas/sitemap/0.9“
xmlns:xhtml=”http://www.w3.org/1999/xhtml“>
<url>
<loc>https://www.example.com/en/page.html</loc>
<xhtml:link
rel=”alternate“
hreflang=”en“
href=”https://www.example.com/en/page.html“/>
<xhtml:link
rel=”alternate“
hreflang=”fr“
href=”https://www.example.com/fr/page.html“/>
<xhtml:link
rel=”alternate“
hreflang=”de“
href=”https://www.example.com/de/page.html“/>
<xhtml:link
rel=”alternate“
hreflang=”x-default“
href=”https://www.example.com/“/>
</url>
<url>
<loc>https://www.example.com/fr/page.html</loc>
<xhtml:link
rel=”alternate“
hreflang=”en“
href=”https://www.example.com/en/page.html“/>
<xhtml:link
rel=”alternate“
hreflang=”fr“
href=”https://www.example.com/fr/page.html“/>
<xhtml:link
rel=”alternate“
hreflang=”de“
href=”https://www.example.com/de/page.html“/>
<xhtml:link
rel=”alternate“
hreflang=”x-default“
href=”https://www.example.com/“/>
</url>
</urlset>
Every URL in the sitemap must include all language versions — not just its own hreflang tag. The reciprocal relationship must be reflected in the sitemap, just as it must in HTML implementation.
For WordPress sites, it’s almost always better to let a plugin (Rank Math + Polylang, or WPML) generate this sitemap automatically rather than creating it manually.
For developers who want complete control, or for static pages not managed by WordPress, you can add hreflang tags directly to your theme’s header.
Important: Only use this method if you’re a developer comfortable editing WordPress theme files. Use a child theme — never edit your parent theme directly, or your changes will be overwritten on the next theme update.
Adding static hreflang tags to header.php:
html
<link rel=”alternate“ hreflang=”en“ href=”https://example.com/“ />
<link rel=”alternate“ hreflang=”fr“ href=”https://example.com/fr/“ />
<link rel=”alternate“ hreflang=”de“ href=”https://example.com/de/“ />
<link rel=”alternate“ hreflang=”es“ href=”https://example.com/es/“ />
<link rel=”alternate“ hreflang=”x-default“ href=”https://example.com/“ />
The limitation of static hreflang in header.php: This adds the same hreflang tags to every page. That only works correctly if every page on your site has the same language versions — which is rarely true. Normally, your About page exists in 3 languages, your blog posts in 2 languages, and some product pages only in 1 language. A single static hreflang block in header.php can’t handle this — it points every page’s hreflang to the homepage equivalents.
Better approach for developers: Use WordPress hooks to add dynamic hreflang tags that output differently on each page based on available translations:
php
// Add to child theme’s functions.php
function wpdepend_hreflang_tags() {
if ( function_exists( ‘pll_the_languages’ ) ) {
// Polylang is active — let Polylang handle hreflang
return;
}
// Custom implementation for non-Polylang sites
global $post;
if ( ! $post ) return;
// Add your dynamic hreflang logic here
}
add_action( ‘wp_head’, ‘wpdepend_hreflang_tags’ );
For truly dynamic hreflang implementation without a translation plugin, the code complexity increases significantly. At this point, using a plugin is almost always the better choice.
These are absolute requirements — not best practices. Violating any of them causes Google to ignore your hreflang tags entirely.
Every page must include a hreflang tag pointing to itself. This is not optional.
Correct:
html
<!– On the English page –>
<link rel=”alternate“ hreflang=”en“ href=”https://example.com/“ />
<link rel=”alternate“ hreflang=”fr“ href=”https://example.com/fr/“ />
Wrong:
html
<!– On the English page — missing self-reference –>
<link rel=”alternate“ hreflang=”fr“ href=”https://example.com/fr/“ />
If Page A lists Page B as an alternate, Page B must list Page A as an alternate. This is the most commonly violated rule and the one most likely to cause Google to ignore your entire hreflang setup.
Think of it like a link exchange that must work both ways. Google uses the reciprocal relationship to confirm that you control both pages and that the relationship is legitimate.
Correct:
html
<!– English page includes: –>
<link rel=”alternate“ hreflang=”en“ href=”https://example.com/“ />
<link rel=”alternate“ hreflang=”fr“ href=”https://example.com/fr/“ />
<!– French page must also include: –>
<link rel=”alternate“ hreflang=”en“ href=”https://example.com/“ />
<link rel=”alternate“ hreflang=”fr“ href=”https://example.com/fr/“ />
Wrong:
html
<!– English page includes French alternate –>
<link rel=”alternate“ hreflang=”fr“ href=”https://example.com/fr/“ />
<!– French page doesn’t reference English page at all — BROKEN –>
Always use the full URL including the protocol and domain. Never use relative paths.
Correct: href=”https://example.com/fr/about/”
Wrong: href=”/fr/about/” or href=”fr/about/”
Only official ISO 639-1 language codes and ISO 3166-1 Alpha-2 country codes are recognized. Made-up or informal codes are silently ignored.
Common mistakes:
The x-default tag tells Google which page to show users whose language or region doesn’t match any of your specific language versions. Without it, Google has to guess — and may show the wrong version to users in markets you haven’t specifically targeted.
html
<link rel=”alternate“ hreflang=”x-default“ href=”https://example.com/“ />
Point x-default to your most universal page — usually your English homepage, or a language selection page if you have one.
Choose one method — HTML head tags, XML sitemap, or HTTP headers — and stick to it. If a translation plugin is adding hreflang to your page <head> and you also manually add hreflang to header.php, you’ll have conflicting duplicate tags that confuse Google.
Beyond the absolute rules above, here are the mistakes that consistently trip up WordPress site owners implementing hreflang:
Having /fr/ in your URL tells Google the content is probably French. But it’s not the same as an hreflang tag. Google might still show your French page to English speakers if it doesn’t understand the page’s intended audience. URL structure and hreflang work together — one doesn’t replace the other.
If your blog archive, product category, or any paginated content exists in multiple languages, each paginated page needs its own hreflang tags. Most translation plugins handle this automatically, but if you’re implementing manually, don’t forget /fr/blog/page/2/ needs hreflang just as much as /fr/blog/.
All URLs in your hreflang tags must return a 200 status code — they must be live pages. If a URL redirects to another URL, Google may not follow the redirect when processing hreflang, causing the relationship to break. Check all your hreflang URLs with a tool like Screaming Frog to confirm they return 200, not 301 or 302.
If a page has a noindex meta tag, adding hreflang to it is pointless — Google won’t index the page and won’t process the hreflang. If you’re noindexing some language versions for any reason, remove their hreflang tags too.
Your canonical tags and hreflang tags must be consistent. A canonical tag that points to a different language version than what the hreflang declares creates conflicting signals that Google will struggle to interpret.
Rule of thumb: Each page’s canonical should point to itself (self-canonical). Don’t canonical your French page to your English page — use hreflang to declare the relationship instead.
One of the most damaging things you can do is implement hreflang on some pages but not others. If 50 of your 100 pages have hreflang and 50 don’t, Google’s understanding of your site’s language structure is inconsistent. Implement hreflang across all language versions of all pages — not selectively.
Over 75% of sites with hreflang tags have implementation errors, according to SEMrush research. Testing is not optional.
Right-click any page on your site, select “View Page Source,” and press Ctrl+F (or Cmd+F). Search for hreflang. You should see:
If you see no hreflang tags at all, your implementation hasn’t taken effect. If you see partial or incomplete tags, you likely have a configuration error in your translation plugin.
Google Search Console has an International Targeting report that appears only when hreflang tags are detected on your site:
If this report doesn’t appear, Google hasn’t detected hreflang tags on your site. If it shows errors, the report will describe what’s wrong.
Note: This report takes time to populate after you first add hreflang tags. Allow 1–2 weeks for Google to crawl and process your site.
Both Ahrefs and Semrush include hreflang validation in their site audit tools:
In Ahrefs Site Audit:
In Semrush Site Audit:
Merkle’s free hreflang validator (technicalseo.com/tools/hreflang/) is specifically designed for hreflang validation. Enter any URL and it checks:
Visit yourdomain.com/sitemap.xml (or sitemap_index.xml). Click into your post sitemap and look for <xhtml:link rel=”alternate” hreflang=”…”> entries inside <url> blocks. If these aren’t present, your sitemap-level hreflang isn’t working — check your plugin settings.
| Your Situation | Recommended Method | Cost |
|---|---|---|
| Starting a new multilingual WordPress site | Polylang (free) + Rank Math (free) | $0 |
| New multilingual site, need WooCommerce support | WPML CMS + Rank Math | $99/year |
| Already using Yoast SEO, adding languages | Polylang (free) + Yoast Premium | $99/year |
| Large site, complex multilingual needs | WPML Agency | $199/year |
| Separate language sites already built, no translation plugin | Hreflang Manager plugin | $0 |
| Developer with full theme control | Dynamic PHP in functions.php |
$0 |
| Non-technical user, visual translation | TranslatePress Free or Pro | $0–$159/year |
| Maximum automatic handling | WPML + Rank Math | $99/year |
Hreflang Maintenance: Keeping It Working Over Time
Hreflang isn’t a one-time setup — it needs ongoing attention as your site grows and evolves.
When you publish new content: Your translation plugin should automatically create hreflang relationships when you add a translated version of a new post. Verify this is happening by checking the source of new pages after publishing.
When you delete pages: Removing a page without updating hreflang on its alternates creates broken references. Most translation plugins handle this automatically, but if you’re using manual implementation, you must update hreflang on all alternate pages when one is deleted.
When you change URLs: If you change a page’s permalink, you need to update hreflang references on all alternate pages. A translation plugin usually handles this. Manual implementation requires updating every reference manually.
Monthly check: Run a quick check in Google Search Console’s International Targeting report and look for any new hreflang errors. Catching issues early prevents them from compounding over time.
At WPDepend, we manage WordPress sites for clients across multiple markets and languages. Hreflang implementation is one of the technical SEO areas we include in our regular site audits — because it’s the kind of thing that silently breaks without anyone noticing until rankings drop.
What we see most often in multilingual WordPress site audits:
How we handle hreflang in our care plans:
For clients with multilingual sites, we include hreflang validation in our monthly SEO health checks. We run Ahrefs site audits, verify GSC International Targeting reports, and confirm that plugin updates haven’t broken hreflang integration. Hreflang implementation errors are subtle — they don’t break your site visibly, they just quietly cost you international traffic month after month.
Our WordPress care plans include SEO health monitoring, technical audit checks, security monitoring, performance optimization, and priority support — all for a flat monthly rate. If you’re running a multilingual WordPress site and want to ensure your hreflang implementation is correct and staying correct, we can help.
Visit wpdepend.com/wordpress-care-plans/ to learn more about our WordPress maintenance services.
Hreflang is an HTML attribute that tells Google and other search engines what language a page is written in and which geographic region it’s intended for. You need it if your WordPress site has content in more than one language, or if you have the same language version tailored for different countries (for example, separate US and UK versions of your English site).
If your WordPress site is entirely in one language and targets one country, you don’t need hreflang. But if you have a French page and an English page covering the same topics, or a US English site and a UK English site, hreflang is essential — without it, Google may flag your pages as duplicate content and rank neither of them properly.
No. WordPress core does not add hreflang tags. You need either a translation plugin (like Polylang, WPML, or TranslatePress), a combination of a translation plugin with an SEO plugin (like Polylang + Rank Math), or manual implementation in your theme’s header or XML sitemap.
The easiest and most reliable approach for most WordPress sites is installing Polylang (free) alongside Rank Math (free) — this combination automatically handles hreflang in both page headers and your XML sitemap, with no additional configuration needed.
The x-default hreflang tag (hreflang=”x-default”) tells Google which page to show users whose language or country doesn’t match any of your specific language versions. It acts as a catch-all fallback.
For example, if your site has English (US), French (France), and German (Germany) versions, a visitor from Japan — where you don’t have a local version — would be directed to whichever URL you’ve set as x-default.
You should use it. Point it to your most universal page — typically your main English homepage or a language-selection landing page if you have one. Most translation plugins add x-default automatically when properly configured.
Check using these four methods:
Allow 1–2 weeks after implementing hreflang for Google to crawl and fully process the tags before expecting to see results in Search Console.
Yes — and this is often necessary. If you sell products in both the US and Australia in English, you’d use en-US for your American pages and en-AU for your Australian pages. Even though both are in English, the regional variants can have different pricing, products, spelling conventions, or regulatory requirements.
Similarly, Canada requires both en-CA (English Canadian) and fr-CA (French Canadian) variants. Switzerland has four official languages (German, French, Italian, Romansh) so may need de-CH, fr-CH, it-CH variants.
The rule is: any time you have meaningfully different content for users in different regions or countries — even if they speak the same language — you should use region-specific hreflang codes.
Hreflang is specifically for multilingual and multi-regional sites. If your WordPress site is entirely in one language targeting one country, hreflang has no effect on your rankings and is not needed.
However, if you have even a small multilingual component — for example, a site that’s 90% English but has a few Spanish blog posts — hreflang is still relevant for those specific pages. For those pages, implementing hreflang correctly prevents the multilingual pages from being treated as duplicate content and ensures they appear in the right regional search results.
Use this checklist to implement and verify hreflang on your WordPress site:
Setup:
Verification:
Ongoing:
A seasoned technology writer and marketing consultant with over a decade of experience helping businesses grow online. I specialize in content marketing, SEO, web design, and e-commerce development. I am enthusiastic about using cutting-edge technology to acquire high-quality traffic, generate leads, and increase sales for my clients.