WordPress GuideSEO → Add hreflang Tags

How to add hreflang tags in WordPress

If your website serves multiple languages or countries, search engines need help showing the right version of your content to the right audience. That’s where hreflang tags come in.

Hreflang tells Google and other search engines, “Hey, this page is the Spanish version of that English page,” or “Here’s the version of this page meant for users in Canada.” WordPress doesn’t add these tags by default—but plugins and a bit of setup can fix that.

Let’s go step-by-step through your best options.

Get fast, reliable hosting for WordPress

Power your site with the industry’s fastest, most optimized WordPress hosting

1. Use a translation plugin (easiest and most reliable)

Translation plugins not only let you translate your content, but they also automatically add hreflang tags based on your language settings.

Popular plugins:

How to set it up (example with TranslatePress):

You don’t need to write any code or adjust headers—TranslatePress handles hreflang in the background based on your translations.

2. Use Yoast SEO (Premium) with a multilingual plugin

Yoast SEO doesn’t add hreflang tags on its own, but when paired with a plugin like Polylang, it can help create multilingual sitemaps with hreflang.

How to set it up:

Yoast works best for hreflang when your translations are set up using a compatible plugin like WPML or Polylang.

3. Use a dedicated hreflang plugin (manual but flexible)

If you’re not using a translation plugin, you can still manually add hreflang tags with a dedicated plugin like Hreflang Manager Lite.

How to set it up:

This method gives you full control, but it’s better for smaller sites or special use cases.

4. Manually add hreflang tags in your theme (not for beginners)

For static sites or developers who want full control, you can hardcode hreflang tags into your theme’s header.php file.

Basic steps:

Important: This method is risky for beginners. Any mistake could break your theme. Use a child theme if you go this route.

Add hreflang to your XML sitemap

Hreflang tags don’t just go in your page’s <head>—you can also include them in your XML sitemap, which helps search engines discover and index all language versions of your content more efficiently.

Most WordPress plugins that support hreflang will also add these tags to your sitemap automatically.

If you’re using TranslatePress:

If you’re using Polylang with Yoast SEO:

How to verify:

If you don’t see them, double-check that your plugin settings are correct and that each piece of content has been properly translated or linked.

Test and validate your hreflang setup

Even if your tags are added correctly, it’s smart to check that search engines can read them.

Tools to use:

What to look for:

Hreflang best practices ✅

Following best practices ensures search engines can properly index and serve the correct language versions of your content.

Always include a self-referencing hreflang tag

Each page should reference itself with a hreflang tag. This helps Google confirm the canonical language version of the page and avoids confusion when indexing.

Use full alternate URLs

Don’t just use slugs like /fr/ or /es/—include the full URL such as https://example.com/fr/. This makes the hreflang tag valid and ensures search engines can reach the correct page.

Match the correct hreflang code for each version

Use accurate ISO language and country codes like en-us for American English or fr-ca for Canadian French. This helps Google deliver the right page to the right regional audience.

Pair hreflang with canonical tags

Canonical tags tell search engines which version of a page is the main one, while hreflang specifies language alternatives. Used together, they improve clarity and indexing accuracy.

Common hreflang mistakes to avoid

Avoiding these mistakes will save you from indexing errors, duplicate content issues, and lost international traffic.

Using incorrect or unofficial language codes

Codes like en-UK are invalid—Google uses ISO standards, so the correct version would be en-GB. Using unsupported codes can result in hreflang tags being ignored altogether.

Forgetting to include reciprocal hreflang links

If Page A points to Page B, then Page B must point back to Page A with its own hreflang tag. Missing this “reciprocal” link causes search engines to ignore both tags.

Mixing plugin-generated and manual hreflang tags

If you’re using a plugin to insert hreflang tags, don’t also hardcode them manually. Conflicting entries can confuse crawlers and lead to SEO issues.

Leaving translated pages out of hreflang entirely

Every language version of your site should be accounted for in hreflang tags. Omitting one can prevent it from appearing in regional search results.

Additional resources

Comprehensive guide to securing WordPress with ModSecurity

This guide provides a comprehensive overview of how to use ModSecurity to enhance the security of your WordPress site.

Best WordPress robots.txt template (example) →

Discover the best robots.txt template to guide search engines and boost your WordPress site’s SEO performance.

















Why security matters for WordPress enterprise hosting

Use the blog as your guide to attacks to watch out for, security best practices, and steps to improve the WordPress protection you already have.

Amanda Valle is Global Director of Organic Search at Liquid Web and a seasoned SEO, user acquisition, digital marketing leader. She has 20+ years of experience in digital marketing, SEO, and content marketing, and holds certifications from SEMrush and Google Analytics. When she’s not driving revenue, she enjoys spending time with her girls.