Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To add hreflang in WordPress, give each language or regional version its own crawlable URL, then publish one complete set of reciprocal hreflang references. You can place the set in the page head, HTTP response headers, or an XML sitemap; Google treats these methods as equivalent, so choose the option your team can maintain reliably.

What hreflang does

Hreflang connects equivalent pages in different languages or regions. It helps search engines select the appropriate URL for a user’s language and location; it does not translate content or replace a canonical tag.

Every localized version must reference itself and every other equivalent version. If the English page links to the Spanish page, the Spanish page must link back to the English page. A missing return reference makes the set incomplete.

Choose an implementation method

Method Best fit What you maintain
HTML in the head A few stable language URLs and a team that can edit templates A complete link set in every localized page
HTTP Link headers Templates cannot be changed, or the alternates belong to non-HTML resources Server responses and reciprocal URL mappings
XML sitemap Many URLs or a workflow where template editing is cumbersome A synchronized sitemap containing every alternate
WordPress plugin Editors need a translation interface, validation, or automated synchronization Translation relationships, plugin settings, and generated output

Do not mix methods casually. Using more than one is possible, but each representation must describe the same complete set or troubleshooting becomes difficult.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Option 1: Add hreflang HTML tags manually

1. Prepare the URL set

  • Create a separate, indexable URL for each language or regional edition.
  • Use absolute HTTPS URLs that return the intended page without a redirect where practical.
  • Decide whether you need language-only values such as en and es, regional values such as en-GB, or both.

2. Add the complete set to the document head

Place one <link rel="alternate" hreflang="..." href="..."> element for every version, including the current page. For example:

<link rel="alternate" hreflang="en" href="https://example.com/en/article/" />
<link rel="alternate" hreflang="es" href="https://example.com/es/article/" />
<link rel="alternate" hreflang="en-GB" href="https://example.com/uk/article/" />
<link rel="alternate" hreflang="x-default" href="https://example.com/language-selector/" />

Repeat the same complete set on every localized URL. The page context changes, but the alternate inventory remains identical.

3. Keep WordPress output consistent

In a custom theme, output the tags through the document head rather than inserting them into page content. A multilingual plugin, SEO plugin, or theme may already generate hreflang; remove duplicate output before adding custom tags. If URLs change, update every page’s set at the same time.

Language and region code rules

  • The language code comes first; an optional region follows, such as en-GB.
  • A region by itself is invalid. Do not use a value such as GB without a language.
  • Use officially assigned ISO 3166-1 alpha-2 region codes. The United Kingdom is GB, not the reserved-style value UK.
  • Use x-default for a fallback page when no language or regional match is available. A language selector is a common destination.
  • Do not combine hreflang with unrelated media or other alternate-link attributes in the same link element.

Canonical tags and hreflang must agree

Each page should normally declare a canonical URL in the same language as the page carrying the hreflang annotations. A Spanish page should canonically point to its Spanish URL, not automatically to the English version. If an exact same-language canonical is unavailable, use the best available substitute rather than creating a conflicting canonical relationship.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Option 2: Send hreflang in HTTP headers

Use HTTP Link response headers when you cannot alter the HTML template or when the resource is not HTML, such as a document download. The header must contain the same complete, reciprocal alternate set as the head implementation. Configure it at the web server, CDN, or application layer and verify the actual response with an HTTP inspection tool; a header added only to an HTML source file has no effect.

Option 3: Put alternates in an XML sitemap

An XML sitemap can carry the alternate relationships when maintaining tags in thousands of templates is impractical. Keep every language or regional URL in the same alternate group, include all reciprocal relationships, submit the sitemap in your search-console property, and ensure it remains fetchable. A sitemap does not excuse broken URLs, redirects, or incomplete groups.

Option 4: Use a WordPress multilingual or hreflang plugin

When a plugin is the safer choice

  • You have many translated posts or products.
  • Editors need to connect translations without editing code.
  • The site runs multiple WordPress installations or a multisite network.
  • You need generated sitemap entries or an inspector for missing reciprocal links.

What to check before activating one

WPML documents connecting translated pages and their hreflang references. The WordPress.org Hreflang Manager listing describes editor-based configuration, language/script/region codes, a front-end tag inspector, and Pro features for multisite synchronization and sitemap support. Confirm that the plugin outputs one complete set, supports your URL structure, and does not conflict with an existing SEO or translation plugin. Features and compatibility can change, so verify the current listing and documentation before deployment.

Validate the implementation

  1. Open the rendered page, not only the editor, and inspect the document <head> for every expected alternate.
  2. For each listed URL, request the page and confirm it returns the matching language or region.
  3. Check reciprocity: every URL must list itself and every other URL in the group.
  4. Check syntax: language first, valid two-letter region when used, and no region-only or reserved code such as UK.
  5. Compare each page’s canonical with its language version.
  6. If using a sitemap, confirm all alternates are present, the sitemap is submitted, and search engines can fetch it.
  7. Use a plugin inspector or third-party checker as an aid, but treat its result as diagnostic; Google notes that listed third-party tools are not maintained or checked by Google.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Common WordPress failure modes

Only one direction is present

Add the missing return reference and regenerate every affected page or sitemap entry. Reciprocity is required for the relationship to be trusted.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The tags exist in the editor but not in the source

Check the rendered HTML or response headers. Page-content shortcodes do not create head annotations unless a plugin explicitly processes them.

Language and region values are mixed up

Replace region-only values with language-region combinations, and change en-UK to en-GB.

The canonical points to another language

Set the canonical to the page’s own language URL, provided that URL is the preferred indexable version.

One translation is missing from some pages

Regenerate the complete set rather than adding only the newly translated URL. Every member of the group must contain the same inventory.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Practical decision rule

Use manual head tags for a small, stable set; headers for non-HTML resources or locked templates; a sitemap for large, programmatically managed URL sets; and a multilingual or dedicated hreflang plugin when editors, multisite synchronization, or automated validation are central to the workflow. Whichever method you choose, correctness comes from complete reciprocal sets, valid codes, crawlable URLs, and language-consistent canonicals.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.