◦ Comprehensive security
◦ 24/7 support
WordPress Guide → SEO → 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):
- Go to Plugins > Add New in your WordPress dashboard.
- Search for TranslatePress, click Install Now, then Activate.
- After activation, go to Settings > TranslatePress..
- Under the General tab, choose your default language.
- Add other languages you want to support using the dropdown menu.
- Click Save Changes.
- Now, use Translate Site to manually translate your content or use automatic translation.
- TranslatePress will automatically insert the correct hreflang tags in the page code.
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:
- Install Yoast SEO from the plugin directory.
- If you’re using Polylang, install and activate it too. You’ll configure your languages just like in the previous section.
- Upgrade to Yoast SEO Premium if you want automatic hreflang support in XML sitemaps.
- Go to SEO > General > Features and make sure XML Sitemaps are enabled.
- Visit your sitemap at yourdomain.com/sitemap_index.xml to confirm hreflang is present for your translated posts and pages.
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:
- Go to Plugins > Add New, search for Hreflang Manager Lite, and install it.
- Once activated, go to Settings > Hreflang Manager.
- Click Add Rule to define a hreflang relationship.
- In the rule setup:
- Select the base post or page you’re working with.
- Add the URL of the translated version.
- Choose the correct hreflang code (like en, fr, or en-us).
- Select the base post or page you’re working with.
- Save the rule. Repeat for each language version of your content.
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:
- From your WordPress dashboard, go to Appearance > Theme File Editor.
- Choose your active theme and find the header.php file.
- Paste in your hreflang tags inside the <head> section, like this:
<link rel="alternate" hreflang="en" href="https://example.com/" /> <link rel="alternate" hreflang="fr" href="https://example.com/fr/" />- Be sure to include a self-referencing tag for each version.
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:
- The free version handles hreflang in your page headers.
- To include hreflang in your sitemap, you’ll need the SEO Pack add-on, available in the TranslatePress premium plan.
- Once installed and activated, it automatically adds hreflang annotations to your sitemap.
If you’re using Polylang with Yoast SEO:
- Polylang automatically manages language versions.
- Yoast SEO automatically generates XML sitemaps.
- Together, they’ll produce a multilingual sitemap that includes hreflang references without additional setup.
How to verify:
- Go to your sitemap by visiting: yourdomain.com/sitemap_index.xml
- Click into one of your post or page sitemaps.
- Look for <xhtml:link rel=”alternate” hreflang=”…”> entries under each URL—they show hreflang relationships.
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:
- Sistrix Hreflang Validator
- Ahrefs Site Audit
- Google Search Console > International Targeting (only shows up if hreflang tags exist)
What to look for:
- Every page has a self-referencing hreflang tag.
- The language and region codes are valid (e.g., en-us, not en-UK).
- Tags match actual URLs and are reciprocated between versions.
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.
Getting started with hreflang tags in WordPress
Hreflang tags help you reach the right audience in the right language—and WordPress makes it easier than you might think.
If your site already has translated content, use a plugin like TranslatePress or Polylang to generate hreflang tags automatically. For more control, dedicated plugins like Hreflang Manager Lite let you assign tags manually.
Ready to upgrade your WordPress experience? Professional hosting improves speeds, security, and reliability for a website and a brand that people find engaging and trustworthy.
Don’t want to deal with server management and maintenance either? Our fully managed hosting for WordPress is the best in the industry. Our team are not only server IT experts, but WordPress hosting experts as well. Your server couldn’t be in better hands.
Click below to explore options or start a chat with one of our WordPress hosting experts now to get answers to your questions and further guidance.
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.