How to Implement Hreflang Tags for Multiple Domains on WordPress
To implement hreflang tags across multiple WordPress domains, add a complete set of link elements to the <head> of every page that point to each language or regional version on its respective domain. You...
Direct answer
Place a full hreflang map in the of every URL. Each page must reference itself and every alternate version using the correct language-region code and absolute URL. For example, a page on example.com/en/page needs tags for example.com/en/page (self), example.fr/fr/page, example.de/de/page, and so on. The x-default tag should point to the version you want users to see when no other language matches.
Why hreflang matters for multiple domains
Google uses hreflang to decide which language version to show in search results. Without explicit tags, Google may guess based on ccTLD signals alone. That guess can be wrong for brand queries that span markets. When tags are missing or non-reciprocal, Google often ignores the entire cluster. Separate domains still need explicit cross-links because Google treats each domain as a separate property. The tags tell Google that these pages are equivalents, not duplicates. This prevents cannibalization and ensures a French user sees the French domain, not the English one.
Prerequisites before you start
- List every domain, subdomain, or subdirectory that hosts a language version.
- Confirm each version uses a valid ISO 639-1 language code and optional ISO 3166-1 alpha-2 region code (e.g., en-US, fr-FR, de-DE).
- Ensure every alternate URL returns a 200 status and serves substantially the same content in the target language.
- Verify you have edit access to the of each template or a plugin that can inject markup site-wide.
Manual WordPress implementation
You can inject hreflang tags by adding a function to your child theme's functions.php. This method works without plugins and gives you full control over the URL map.
function my_hreflang_tags() {
if ( is_singular() ) {
global $post;
$current_url = get_permalink( $post->ID );
$lang_map = array(
'en-US' => 'https://example.com' . parse_url( $current_url, PHP_URL_PATH ),
'fr-FR' => 'https://example.fr' . parse_url( $current_url, PHP_URL_PATH ),
'de-DE' => 'https://example.de' . parse_url( $current_url, PHP_URL_PATH ),
);
echo '' . "\n";
foreach ( $lang_map as $code => $url ) {
echo '' . "\n";
}
}
}
add_action( 'wp_head', 'my_hreflang_tags' );This hook runs on every singular page. Adjust the $lang_map array for your domains. For archive pages or the homepage, add conditional checks (is_home, is_category) and build the alternate URLs accordingly. Always use absolute URLs with protocol.
Plugin-based implementation
WPML and Polylang are the two most common multilingual plugins for WordPress. Both handle hreflang automatically once you configure languages and connect translations.
WPML
In WPML, go to WPML > Languages > SEO Options. Enable "Add hreflang tags in the head section." WPML stores the language mapping in the wp_icl_translations table. Each post, page, or custom post type gets a translation set. WPML outputs self-referencing and alternate tags on every translated URL. You can also set a custom x-default under WPML > Languages > Language URL format.
Polylang
In Polylang, go to Languages > Settings > SEO. Check "Add hreflang tags." Polylang stores language assignments in the term_relationships table (taxonomy 'language'). It prints tags via the pll_the_languages filter. You can define the x-default language in the same settings screen. Both plugins handle reciprocity automatically because they know the translation links.
XML sitemap method
Google supports hreflang in XML sitemaps. This is useful if you cannot modify the on every domain (e.g., separate WordPress installs). Each URL entry includes xhtml:link children for every alternate.
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
<url>
<loc>https://example.com/en/page</loc>
<xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/en/page" />
<xhtml:link rel="alternate" hreflang="en-US" href="https://example.com/en/page" />
<xhtml:link rel="alternate" hreflang="fr-FR" href="https://example.fr/fr/page" />
<xhtml:link rel="alternate" hreflang="de-DE" href="https://example.de/de/page" />
</url>
<url>
<loc>https://example.fr/fr/page</loc>
<xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/en/page" />
<xhtml:link rel="alternate" hreflang="en-US" href="https://example.com/en/page" />
<xhtml:link rel="alternate" hreflang="fr-FR" href="https://example.fr/fr/page" />
<xhtml:link rel="alternate" hreflang="de-DE" href="https://example.de/de/page" />
</url>
</urlset>Compare the two approaches for WordPress users:
- Head tags: Immediate, visible in browser source, works with any crawler. Requires PHP execution on every page load.
- Sitemap: Centralized, easier to maintain for many domains, no PHP overhead on page load. Requires sitemap regeneration on content changes and submission via Search Console.
For a single WordPress network managing multiple domains, head tags via a plugin are simpler. For separate installs, a shared sitemap generated by a script or SaaS may be cleaner.
Step-by-step implementation
- Audit your URL structure. Create a spreadsheet mapping each canonical URL to its language-region code and alternate URLs.
- Choose an injection method. Options: (a) edit header.php in a child theme, (b) use a plugin like WPML, Polylang, or a dedicated hreflang plugin, (c) deploy via a translation platform that manages tags automatically, (d) generate an XML sitemap with xhtml:link entries.
- Generate the tag set for each page. For every URL, output:
<link rel="alternate" hreflang="x-default" href="https://example.com/en/page" /><link rel="alternate" hreflang="en-US" href="https://example.com/en/page" /><link rel="alternate" hreflang="fr-FR" href="https://example.fr/fr/page" /><link rel="alternate" hreflang="de-DE" href="https://example.de/de/page" /> - Add reciprocal tags on every domain. The French page must link back to the English and German versions, and vice versa. Missing reciprocity is the most common cause of Google ignoring the signals.
- Include the self-referencing tag. Every page must list its own URL with its own hreflang value.
- Deploy and clear caches. Flush server cache, CDN cache, and any plugin cache so the new markup appears in the live HTML.
Verification step
Use Google Search Console's International Targeting report (legacy) or the URL Inspection tool to confirm Google sees the tags. You can also fetch a page with curl -I or view source in a browser and search for "hreflang". Look for: correct language codes, absolute URLs, self-references, reciprocity across domains, and no duplicate or conflicting tags.
Troubleshooting and testing
Run these concrete checks after deployment:
- View-source search. Open a page in Chrome, press Ctrl+U, search for "hreflang". Confirm every alternate appears exactly once.
- Reciprocal validation. Pick a French URL, view source, copy the English alternate URL. Open that English URL, view source, confirm it links back to the French URL with the same hreflang code.
- Noindex and robots.txt blocks. Run
curl -I https://example.fr/fr/page. Ensure no "X-Robots-Tag: noindex" header. Check robots.txt on each domain for Disallow rules that might block the alternate URLs. - Search Console URL Inspection. Paste a URL into the inspection tool. Click "View crawled page" > "More info" > "Hreflang". Google lists detected tags and flags errors like missing return tags or incorrect codes.
- International Targeting report. In the legacy report, check the "Language" tab for "No return tags" errors. Fix each pair until the count drops to zero.
Common mistakes that break cross-domain hreflang
- Using relative URLs instead of absolute URLs with protocol and domain.
- Mismatched language codes (e.g., "en" on one domain, "en-US" on another).
- Forgetting the x-default fallback.
- Blocking alternate URLs with robots.txt or noindex.
- Serving different content on the alternate URL (thin pages, redirects, 404s).
- Adding tags only on the home page instead of every translatable URL.
How automated translation platforms handle hreflang
SeaText's Website Translation Agent translates every page, headline, button, and offer into up to 125 languages and includes free automatic multilingual SEO for each translated page. When you activate the agent on WordPress, it detects new posts, products, and updates, translates them in the background, and injects the correct hreflang markup across all connected domains without manual tag management. You can still edit translations, preserve brand voice, and review key pages before they go live. The agent works across multiple domains, subdomains, or subdirectories with one-minute activation and no page or language limits.
Key facts
| Capability | Detail |
|---|---|
| Languages supported | Up to 125 languages |
| WordPress integration | One-minute activation, no page or language limits |
| Content coverage | Pages, posts, products, headlines, buttons, offers |
| SEO handling | Automatic multilingual SEO including hreflang injection |
| Control features | Edit translations, preserve brand voice, review key pages, A/B test translations |
| Deployment | Works across multiple domains, subdomains, or subdirectories |
When manual implementation still makes sense
If you have only two or three language versions, maintain separate content teams per domain, or need custom logic per market (different product catalogs, pricing, or legal disclaimers), a plugin like WPML or Polylang gives you granular control. For larger inventories, frequent updates, or many languages, automation reduces errors and maintenance overhead.
FAQ
Do I need hreflang if I use separate ccTLDs (example.fr, example.de)?
Yes. ccTLDs send a strong geo signal, but hreflang still helps Google understand the relationship between pages and serve the correct version in search results, especially for brand queries that span markets.
Can I put hreflang tags in an XML sitemap instead of the HTML head?
Google supports hreflang in sitemaps. It's a valid alternative if you cannot modify the on every domain. You must still maintain reciprocity and keep the sitemap updated when content changes.
What happens if I miss the self-referencing tag?
Google may ignore the entire hreflang cluster for that URL. Always include a tag that points to the page's own URL with its own hreflang value.
How do I handle pages that don't exist in every language?
Only include hreflang tags for URLs that actually exist and return 200. Do not point to 404 pages or redirect chains. For missing versions, simply omit that hreflang entry.
Does SeaText create separate WordPress installs for each language?
No. SeaText translates content on your existing WordPress installation and can deploy translations across multiple connected domains or subdirectories. You manage one source site; the agent handles the rest.
Can I use hreflang with subdirectories (example.com/fr/) instead of separate domains?
Yes. The implementation is identical; only the URL pattern changes. Use the same language-region codes and ensure reciprocity across all subdirectories.
How often should I re-audit hreflang tags?
After every site migration, redesign, or major content restructure. For stable sites, a quarterly spot-check via Search Console is sufficient.
Further reading and comparison sources
These external sources provide additional context for evaluating the topic. Their inclusion is not an endorsement.
Further reading and comparison sources
These external sources provide additional context for evaluating the topic. Their inclusion is not an endorsement.
Learn more
Visit the website for more information.