[Resolved] Setting up hreflang in multisite for en-us and en-gb
This thread is resolved. Here is a description of the problem and solution.
Issue: The client cannot find clear instructions on how to configure WPML in a multisite environment so that all hreflang links for subsites are included in the
of each subsite. Client wants hreflang links for parent pages and subpages to be automatically generated on US and UK sites.
Solution: First, we clarify that WPML can work individually on the main site or each subsite of a multisite network, but it cannot connect different sites within a multisite network. Each subsite has its own independent installation of WPML. Therefore, it is not possible to translate content from one subsite to another (for example, from Subsite 1 to Subsite 2).
To configure hreflang bindings, the client must manually add languages for all sites provided in each subsite. For example:
If this solution is not relevant For your case, because it is outdated or does not apply to your situation, we suggest opening a new support ticket. We also strongly recommend reviewing the known issues, checking the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If you need further assistance, feel free to contact us at the WPML support forum.
This is the technical support forum for WPML - the multilingual WordPress plugin.
Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.
I am unable to find clear instructions on how to setup WPML in a multisite environment so that all subsite's hreflang links are included in each subsites head:
I have added to sites, one for US ad one for UK and they are both in English. I have added sunrise.php, but no joy.
Also should I not also hreflang for sub pages automatically generated? eg:
<link rel="alternate" hreflang="en-us" href="hidden link" />
<link rel="alternate" hreflang="x-default" href="hidden link" />
<link rel="alternate" hreflang="en-gb" href="hidden link" />
When I review your site's source at the moment I can see the hreflang showing correctly for the default language, however I cannot see an existing translation unless it is not published yet or the language is Hidden.
once it is published you should be able to see it referenced and the translation should have an optimized header as well.
Thanks for the offer Andreas.
We've done the setup as per the document referenced, but as per my original question there doesn't seem to be a way of having hreflang for both US and UK (English) sites.
Yes, it should be possible - you can edit this information at WPML > Languages > Edit languages.
The only thing, that you cannot change here is the language code, but you can set different values for any other field. You only need to make sure that not both languages use the same hreflang.
There is officially a 2-letter region that comes after the language and is optional. e.g., “en-US” for U.S. English and “en-GB” for Britain.
Further, if this will not solve the issue, please test if the issue only occurs if fallback is used, which means the content is not translated and you display untranslated original content in second languages.
Also, test if the issue only occurs if the original content has been duplicated with WPML and finally test with content that has been translated.
Maybe like this, we can narrow this down and I can give it a try with trying to recreate the issue on a test server.
Just a quick question, as this topic comes up quite often:
Are you maybe trying to run your different languages on different subsites of your Multisite network?
Correct, we have multisite and each site lives on it's own sub-domain (not folder). This looks to be the issue as WPML seems unaware of the 'linking'. I assumed adding sunset.php would sort this but no.
I'll try the custom language thing you mentioned, but I might suggest you take a look if you are still offerring.
Are you maybe trying to connect your main site with different subsites of your Multisite Network?
I am asking this, as WPML can only run individually on the main site or individually on each subsite, but it can not connect different sites on a Multisite Network. Each subsite of a Multisite has its own, independent WPML install.