Skip to content
WordPress

How to Add Hreflang Tags in WordPress with a Plugin

· · 10 min read
Add Hreflang Tags in WordPress with a Plugin

Hreflang tags tell search engines which version of a page to serve based on a visitor’s language and region. Without them, Google has to guess, and it guesses wrong often enough to matter: a UK visitor lands on your US pricing page, or your Spanish and Mexican Spanish content compete against each other in search results instead of each ranking for their own audience. This guide covers what hreflang actually does, how to implement it through a plugin rather than hand-editing template files, and the mistakes that cause hreflang setups to silently fail even when they look correct in the plugin’s settings screen.

What Hreflang Actually Solves

An hreflang tag is an HTML attribute, `rel=”alternate” hreflang=”x”`, that lives in a page’s `<head>` and points to equivalent versions of that page in other languages or regions. A basic pair looks like this:

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

Two problems get solved by having this in place. Search engines stop treating near-identical content in different regional URLs as duplicate content competing against itself, and search engines start serving the correct regional version to the correct searcher instead of whichever version happens to rank higher generically.

Neither of these is automatic just because you have translated content sitting on different URLs. Without hreflang, Google’s algorithm does its own language and location detection, and it is right often enough that most site owners never notice the failures, until they check search console data by country and see a mismatch between where traffic to the Spanish pages is actually coming from and where it should be coming from.

Who Actually Needs This

If your site has one version of every page in one language, hreflang does nothing for you and adds complexity for no benefit. It exists specifically for sites running two or more language or region variants of the same content: a company with separate US and UK pricing pages, a blog published in English and German, an ecommerce store with region-specific product catalogs under the same domain.

A rough rule that holds up in practice: if you can point to two URLs on your site that are translations or regional variants of the same underlying content, you need hreflang connecting them. If every page on your site is unique content with no regional twin, skip this entirely and put the effort into content instead.

Choosing a Plugin

Four options come up repeatedly for WordPress hreflang management, each suited to a different situation.

WPML is the heaviest option and the most complete, since it manages the entire multilingual content structure, not just the hreflang tags, translation workflow, language switchers, and URL structure all live inside it. If you are building a genuinely multilingual site from scratch, WPML (a paid plugin) generates hreflang tags automatically as a byproduct of how it structures translated content.

Polylang covers similar ground to WPML with a capable free tier, adding hreflang tags automatically for content you have translated through its interface. It is a common choice for sites that want multilingual functionality without WPML’s price tag, though the free tier has narrower CPT and taxonomy translation support than the paid Polylang Pro version.

Yoast SEO Premium adds hreflang support as one feature among its broader SEO toolset, useful if you already run Yoast for general SEO and do not want a second, dedicated multilingual plugin layered on top.

A narrower, purpose-built hreflang manager plugin makes sense if your content is not actually multilingual in WordPress’s structural sense, say, you maintain separate WordPress installs or subdomains per region rather than translated posts inside one install, and just need the hreflang linking layer without a full translation management system attached.

Setting Up a Dedicated Hreflang Plugin

The walkthrough below uses a standalone hreflang manager as the example since it isolates the concept most clearly, but the underlying logic (map a post or page to its regional equivalents, specify the language-region code, save) applies across WPML, Polylang, and Yoast’s implementation too, just inside a larger interface.

Step 1: Install and Activate

  1. From your dashboard, go to Plugins > Add New.
  2. Search for your chosen hreflang plugin by name.
  3. Click Install Now, then Activate.

Step 2: Map Your Regional Pages

  1. Open the plugin’s settings, usually added as its own menu item in the sidebar.
  2. Select the post, page, or taxonomy term you are configuring.
  3. Add an entry for each regional or language variant, pairing a URL with its hreflang code.
  4. Repeat for every language or region version of that piece of content, and be sure to add the return links, the English page needs to list the Spanish page as an alternate, and the Spanish page needs to list the English page back. One-directional linking is one of the most common causes of hreflang tags that Google Search Console flags as errors.

Step 3: Set an x-default

If you serve a fallback version of a page to visitors whose language or region does not match any of your specific targets, add an x-default tag pointing to that fallback:

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

This is optional but recommended for any site with more than two language variants, since without it, visitors outside your explicitly targeted regions get whatever Google’s own guess produces instead of the page you actually intended as the catch-all.

Step 4: Verify the Tags Are Actually Rendering

Visit a live page and view its source (right-click, View Page Source, or Ctrl+U / Cmd+Option+U). Search for “hreflang” and confirm the tags appear in the `<head>` with the correct URLs and codes. A plugin setting that looks saved correctly in wp-admin does not guarantee the tag actually renders on the front end, caching plugins in particular can serve a stale cached version of the head that predates your hreflang changes.

Getting the Language-Region Codes Right

Hreflang codes follow ISO 639-1 for language and ISO 3166-1 Alpha 2 for region, combined with a hyphen: `en-us`, `es-mx`, `fr-ca`. Getting this format wrong is one of the most common sources of hreflang errors, and it is worth double-checking against the actual ISO tables rather than guessing, since some intuitive-seeming codes are wrong (the UK’s correct code is `en-gb`, not `en-uk`, which trips up a surprising number of setups).

You can also target language without region, `es` alone rather than `es-mx` or `es-es` specifically, if you have one Spanish version intended for all Spanish speakers rather than region-specific variants. Do not mix a plain language code and a region-specific code for the same language on the same site without a clear hierarchy; Google’s documentation recommends against ambiguous overlapping targeting, and it can cause the wrong version to surface unpredictably.

Testing Beyond the Page Source

Viewing source confirms the tags exist. It does not confirm Google can see them correctly, or that every regional pair links back symmetrically. Google Search Console’s International Targeting report (in older accounts) or the URL Inspection tool flags hreflang errors it has actually detected during crawling, which is worth checking a few days after implementation rather than relying purely on manual inspection.

Third-party tools built specifically for hreflang auditing, Screaming Frog’s crawler has a dedicated hreflang tab, or standalone validators like the one at hreflang.org, catch return-link mismatches across an entire site far faster than manually clicking through pages one at a time. For a site with more than a handful of regional page pairs, running a crawl-based audit after initial setup, and again after any major content restructuring, catches broken pairs before they show up as Search Console warnings weeks later.

Common Failure Points

Missing return links are the single most frequent cause of hreflang errors flagged in Search Console. If page A lists page B as its Spanish alternate but page B does not list page A back as the English alternate, Google treats the whole pair as invalid and may ignore both hreflang declarations entirely rather than partially trusting a one-sided relationship.

Hreflang tags pointing at URLs blocked by robots.txt do nothing useful. Google cannot crawl and confirm a target page it is told not to fetch, which makes the hreflang annotation pointless even though it appears correctly formatted in the source.

Canonical tags fighting hreflang tags on the same page produce confusing, sometimes contradictory signals. If a Spanish page’s canonical tag points back to the English version instead of to itself, you are telling Google two different things about which URL is the “real” one, and hreflang’s regional targeting gets undermined by the canonical’s stronger consolidation signal.

Inconsistent hreflang tags across a set that should be symmetric, three regions defined on one page but only two referenced back from a second page in the set, produce partial errors that are easy to miss because two of the three relationships work fine and only the third is broken.

URL Structure Decides How Hard This Is

Before touching a plugin, the underlying URL structure for your regional content determines how much manual mapping you are signing up for. Three common patterns exist, and they are not equally easy to maintain.

Subdirectories, example.com/en-us/ and example.com/es-mx/, are the simplest to manage inside a single WordPress install and the pattern WPML and Polylang both build around by default. All the content lives in one database, one set of plugins, one hosting bill.

Subdomains, us.example.com and mx.example.com, separate content more cleanly but usually mean either a WordPress multisite network or entirely separate installs, both of which add hreflang complexity since the tags now need to reference across install boundaries rather than within one.

Separate top-level domains, example.com and example.mx, are the heaviest option and typically reserved for large international brands where local domain trust and local hosting matter more than shared infrastructure convenience. Hreflang still works across separate domains, the tag does not care whether the target URL is on the same domain or a different one, but keeping two entirely separate WordPress installs synchronized in content structure is its own ongoing maintenance burden that has nothing to do with hreflang specifically.

If you are starting from scratch and have no existing content structure to work around, subdirectories inside a single multilingual-plugin-managed install is the path of least resistance for hreflang maintenance, even if a separate ccTLD sometimes wins on other grounds like local SEO trust signals or payment processor requirements.

Hreflang and Ecommerce Regional Catalogs

Stores running region-specific pricing or currency, a US catalog in dollars and a UK catalog in pounds built on WooCommerce or a similar plugin, need hreflang for exactly the same duplicate-content reason as translated blog content, even when the language is identical between the two versions. Google has no way to know that /us/product-x/ and /uk/product-x/ are intentionally separate regional listings rather than accidental duplicates unless hreflang tells it so explicitly.

This case gets missed constantly because teams associate hreflang purely with language translation and forget that regional targeting without any language change is just as valid a use case. If your store shows different prices, different shipping options, or different stock availability by region on otherwise identical product pages, that is a hreflang scenario regardless of whether any text was translated.

Reading Search Console’s Hreflang Error Messages

Google Search Console surfaces hreflang problems, but the wording of its warnings is not always self-explanatory to someone setting this up for the first time. A few of the common ones translated into plain language:

“No return tags” means exactly the missing-return-link problem covered above: page A references page B, but page B does not reference page A back. Fix by adding the missing reciprocal tag on the second page.

“Incorrect language/region code” flags a hreflang value that does not match the ISO format Google expects, most often a made-up or slightly misspelled code (`en-uk` instead of `en-gb` is the classic example). Cross-check the exact code against ISO 639-1 and ISO 3166-1 tables rather than guessing from memory.

“Multiple entries with same language/region code” happens when two different URLs on the same page both claim to be the `es-mx` version, usually from a leftover old mapping that was never removed when a page was restructured or a URL changed. Clean up the plugin’s stored mappings for that content rather than adding a third, correct entry on top of the conflicting two.

These reports are not real-time. Search Console reflects what Google’s crawler last saw, which can lag your actual live site by days, so a fix you deployed this morning will not necessarily clear from the report until the next crawl pass.

Keeping Hreflang Accurate as Content Changes

Hreflang setups tend to degrade quietly over time, not because the initial setup was wrong, but because ongoing content work does not automatically keep regional mappings in sync. A translated page gets deleted and its English counterpart is left pointing at a dead URL. A URL gets restructured for SEO reasons and the hreflang mapping is not updated to match. A new regional variant gets added months later and never gets linked into the existing set.

Building a recurring check into your content workflow, a quarterly crawl with Screaming Frog’s hreflang tab, or a calendar reminder to spot-check Search Console’s international report, catches this drift before it accumulates into a large cleanup project. Treating hreflang as a set-once, forget-forever configuration is the single most common reason sites end up with a confusing tangle of broken regional pairs a year or two after initial setup.

Frequently Asked Questions

Does hreflang affect ranking directly?
Not as a ranking factor in the traditional sense. It affects which version of a page shows up for a given searcher, and it prevents regional duplicate-content cannibalization between your own pages, both of which influence traffic and click-through rate even without being a direct ranking signal.

Do I need hreflang if I only have one language but multiple country-specific domains?
Yes, if the content is substantially the same across those domains, which is exactly the scenario hreflang is built to disambiguate, same language, different intended audience by region.

Can I add hreflang tags manually without any plugin?
Yes, by editing your theme’s header.php to output the tags conditionally per page, but this requires ongoing manual maintenance as pages are added, and a plugin handles that maintenance automatically once regional pairs are mapped once.

How long does it take Google to recognize new hreflang tags?
There is no fixed timeline; it depends on how frequently Google recrawls the affected pages. For established, frequently crawled pages, changes can show up in Search Console’s international reports within a couple of weeks. For lower-traffic pages, it can take considerably longer.