On a WordPress site, hreflang comes from your translation plugin. WordPress itself runs a site in one language, which it prints as the lang attribute, and has no idea that /fr/rooms/ is the French version of /rooms/. WPML, Polylang, TranslatePress, Weglot and LangRelay each add the tags for the languages they manage, with different defaults for x-default and for sitemaps. Yoast SEO and Rank Math look after titles, descriptions, canonicals and the sitemap, and the translation plugin adds hreflang to them. To check the result, open a translated URL's source and compare its hreflang set, canonical and lang with the original's.
Who prints what on a multilingual WordPress site#
Three pieces of software write into the <head> of a translated page:
Yoast's help center says Yoast SEO adds canonical URLs to a WordPress site, and that its wpseo_canonical filter can change them or remove the tag. On the hreflang side, WPML's documentation for its Yoast SEO and Rank Math integration says the hreflang tags and the language-aware sitemaps come from WPML core, and Rank Math's own knowledge base says WPML adds the hreflang to translated pages. In both cases the SEO plugin owns the canonical and the translation plugin owns the hreflang.
What each translation plugin prints by default#
This is what each vendor's documentation said on 2026-10-06. Where a cell says the documentation does not cover it, check the plugin's output on your own site rather than assuming either way.
The defaults differ because the vendors read Google's guidance on x-default differently, which the article on self-referencing hreflang and x-default goes into. If you switch translation plugin, check x-default afterwards: it may change with the plugin without anyone deciding it should.
WPML prints hreflang in the head and inside the sitemaps of Yoast SEO and Rank Math, and its WPML SEO add-on, included with the Multilingual CMS and Agency plans, carries those plugins' fields into translations. Polylang's filter lets a developer reshape the whole list in a few lines of code. TranslatePress puts x-default behind a switch a site owner can set without code. Weglot's WordPress help explains when x-default is worth adding and gives the filter to add it. LangRelay's set needs no configuration, but it has no sitemap output and no way to point x-default anywhere but the original.
A correct result, in one example#
A small hotel's WordPress site is in English, with French and German translations under /fr/ and /de/. This is what the head of the French rooms page should contain once the plugins have done their work, with the lines that matter for hreflang:
<html lang="fr">
<head>
<title>Nos chambres | Orchard Inn</title>
<link rel="canonical" href="https://www.orchardinn.example/fr/rooms/">
<link rel="alternate" hreflang="en" href="https://www.orchardinn.example/rooms/">
<link rel="alternate" hreflang="fr" href="https://www.orchardinn.example/fr/rooms/">
<link rel="alternate" hreflang="de" href="https://www.orchardinn.example/de/rooms/">
<link rel="alternate" hreflang="x-default" href="https://www.orchardinn.example/rooms/">
</head>The title is in French, the canonical names the French URL, lang says French, and the alternate set is the one that also appears on the English and German rooms pages. Whether x-default is present depends on the plugin, as the table above shows.
How to check hreflang on a WordPress site#
WPML's documentation gives the first step: open a translated URL, view the source, and search for hreflang. From a terminal you can see the HTML exactly as your server sends it, before any script runs:
curl -s https://www.orchardinn.example/fr/rooms/ \
| grep -iE 'hreflang|rel="canonical"|<html'Then work through this list, on the original and on one translated page per language:
- One set only. Each language should appear once. Two
frlines usually mean two plugins are printing sets, for example an old translation plugin left active after a switch. - The set is identical on every version and includes the page itself. Google asks for both, and ignores a pair that does not point both ways.
- The codes use a hyphen, not an underscore. WordPress locales are written
fr_FR; an hreflang value isfrorfr-FR. - The canonical on the translated page names the translated URL. If it names the English page, read hreflang and canonical tags before changing anything.
langon the translated page is the translated language. A French page withlang="en-US"is a sign the plugin left the theme's value alone; hreflang vs the HTML lang attribute explains why that still matters.- Every URL in the set answers 200, without a redirect and without
noindex. - If your plugin puts hreflang in the sitemap, open the sitemap and find one translated URL's entry. The article on hreflang in XML sitemaps shows what a valid entry looks like.
If you use a page cache, clear it after you change a translation plugin's settings and fetch the page again before you trust what you see.
Common hreflang mistakes on WordPress#
How LangRelay does it on WordPress#
LangRelay's WordPress plugin translates the rendered page, so /fr/rooms/ is served from the original rooms post and your posts are not duplicated. That changes where some of the head lines come from, and the plugin handles each of them:
- Hreflang. The plugin prints the set LangRelay sends at
wp_head, after your title and meta description, without adding or removing entries. The set lists the original, every language in which that page's translation is live, and x-default on the original. The same lines appear on every version. - Canonical. On a translated page the plugin points the existing canonical tag, whether Yoast SEO, Rank Math or WordPress core printed it, at the translated URL, and does the same for
og:url. If the page had no canonical, it adds one. lang. On a translated page the plugin setslangon the<html>element to the language's tag. The original keeps the value WordPress prints for the site language.- Title and meta. The title, meta description and Open Graph and Twitter tags your SEO plugin prints are translated with the rest of the page, and you can edit them in the Visual editor's SEO panel.
- Sitemaps. The plugin leaves them alone. Your SEO plugin's sitemap keeps listing your original URLs, and the translated URLs are linked from the hreflang set, the language switcher and the internal links on translated pages.
After a release, LangRelay fetches each translated URL and checks its lang, its canonical, its own hreflang entry, x-default and noindex. A page that contradicts what was published is flagged on the release instead of being reported as delivered. Your Yoast SEO or Rank Math settings stay as they are. Keep a second translation plugin off the pages LangRelay translates, or each page will print two sets.
Our hreflang guide is the hub for this topic, the multilingual SEO page sums up what the plugin covers, and the guide to translating a WordPress site walks through the setup. To see the plugin's output on your own site, book a demo.
Sources
The pages this one cites, with the day each was read.
- 01How to Translate Your Site for Multilingual SEO (WPML documentation, last updated 2026-07-02)wpml.org, checked 6 October 2026
- 02WPML SEO: Multilingual Yoast SEO and Rank Math (WPML documentation)wpml.org, checked 6 October 2026
- 03Multilingual SEO with Rank Math SEO and WPML (Rank Math knowledge base)rankmath.com, checked 6 October 2026
- 04How to change the canonical URL in Yoast SEO for WordPress (Yoast help center)yoast.com, checked 6 October 2026
- 05Features (Polylang)polylang.pro, checked 6 October 2026
- 06Hreflang tag attributes and Polylang: everything you need to know (Polylang, 2023-02-21)polylang.pro, checked 6 October 2026
- 07Filter reference (Polylang documentation)polylang.pro, checked 6 October 2026
- 08Multilingual SEO (TranslatePress, last updated 2026-03-03)translatepress.com, checked 6 October 2026
- 09SEO Pack (TranslatePress documentation)translatepress.com, checked 6 October 2026
- 10Advanced Settings (TranslatePress documentation)translatepress.com, checked 6 October 2026
- 11Change hreflang localization (TranslatePress documentation)translatepress.com, checked 6 October 2026
- 12WordPress: how does Weglot manage the SEO? (Weglot Help Center, last updated 2026-06-29)support.weglot.com, checked 6 October 2026
- 13get_language_attributes() (WordPress Developer Resources)developer.wordpress.org, checked 6 October 2026
- 14Localized versions of your pages (Google Search Central, last updated 2026-09-21)developers.google.com, checked 6 October 2026




