WordPress multi-domain with multiple sites with multiple languages

Struggled for days to solve a similar problem. Tried Polylang, WPML, all sorts of custom codes. Did some research on domaining and languages.

I have started with subdomains. myfancysite.com, then adding de.myfancysite.com, it.myfancysite.com etc. Then I have realized I’m losing some potential.

Came up with some conclusion:

Spreading multilanguage project on ccTLDs is more expensive but WAY better than working with subdomains / folders, because I can host each website in their respective country and I don’t have to tie myself up to CDN providers like Cloudflare. However, it isn’t only expensive, but also complicated. Most of the plugins available for multilanguage projects (free OR paid) treat the subdomain setup, with scarce info about different domains spread on different TLDs. Tried some custom plugins, paid for some. There was something missing. Always.

So this is what I did.

Generated a custom-named Underscores.me theme. The former _s WordPress theme is maintained by Automattic, the commercial company behind WordPress. Reliable. I don’t have to pay custom development, I will work with that’s WELL known. I won’t use paid themes either. They’re (again) unreliable, from multiple points of view. Underscores shouldn’t be unreliable. I don’t have to work with child-themes, I’m also branded somehow.

Installed the first project locally. Started to set it up. I have used some plugins, not so many, and the most installed ones (well maintained) – a SEO plugin, remove category from URL, really simple ssl, contact form 7 together with really simple captcha, easy updates manager, and ACF.

The latter was crucial for my SEO. It renders fields. Like my hreflang fields.

Added a group in ACF, named it Languages. Group made available for both posts and pages. Added a field for each of my corresponding languages. Named the fields german_language, spanish_language, italian_language etc.

Echoed the fields in header.php, somewhere in the <head> area.

<link rel="alternate" hreflang="de" href="https://wordpress.stackexchange.com/questions/295337/<?php echo the_field("german_language'); ?>">

ACF creates the variable for me and saves it in DB.

I have used the same variable to create a widget with flags.

If there’s a page or a post who doesn’t exist on other domains, I will just add a conditional to my hrelang code echo (isset could work, shouldn’t be hard).

Then installed the resulting website everywhere. Backed up and exported using WPRESS (paid plugin for import, but I have it anyway from other projects). You can use anything else to export/import the same project. Changed the language, updated translations.

Wash, rinse, repeat.

Google won’t see duplicate content if you use hreflang correctly. This is the key – hreflang.

The future is bright.