Skip Navigation

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:

SubSite - US<br />- English-us (default)<br />- Spanish<br />- English-gb (Custom Language)

< br/>

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.

This topic contains 11 replies, has 3 voices.

Last updated by peteN 8 months ago.

Assisted by: Andreas W..

Author Posts
March 15, 2024 at 4:12 pm #15415322

peteN

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.

I want the following:

US Site Head:
<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" />

UK Site head:
<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" />

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" />

Thanks

March 15, 2024 at 4:37 pm #15415418

Andreas W.
Supporter

Languages: English (English ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Hello,

It would be very helpful if you could send us the WPML information for troubleshooting.
More information about this here:
https://wpml.org/de/faq/provide-debug-information-faster-support/

Please only use the private reply form and do not paste this information into a comment on this ticket.

Best regards
Andreas

March 15, 2024 at 4:50 pm #15415464

peteN

There isn't really any debugging issue.
It's not an error - It's more a general configuration/setup question

March 15, 2024 at 5:31 pm #15415611

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-08:00)

Hi,

In case you have not reviewed our documentation on setting up WPML for multisite environments, you can find it here:
https://wpml.org/documentation/support/multisite-support/

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.

Let us know your results, please.

March 15, 2024 at 7:28 pm #15415923

Andreas W.
Supporter

Languages: English (English ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Have you already translated the homepage into all languages and are those pages published?

I can offer to have a look at the site, as super admin, if you agree.

Let me know if you agree and I will enable the private reply form, so that you can provide me access.

March 18, 2024 at 4:23 pm #15422543

peteN

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.

March 19, 2024 at 9:42 pm #15428950

Andreas W.
Supporter

Languages: English (English ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Hello,

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?

Best regards
Andreas

March 20, 2024 at 10:05 am #15430249

peteN

Thanks Andreas,

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.

March 20, 2024 at 10:41 am #15430504

Andreas W.
Supporter

Languages: English (English ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Sorry, I need to ask my question again.

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.

Could this be the reason for the issue?

March 20, 2024 at 10:56 am #15430534

peteN

That makes sense - Although in that case not sure why WPML has documented multi-site setup if it doesn't work?!?

So basically I have to manually add the languages for all the intended sites to each subsite

eg.

SubSite1 - US
- English-us (default)
- Spanish
- English-gb (Custom language)

SubSite2 - Spain
- English-us (default)
- Spanish
- English-gb (Custom language)

SubSite3 - UK
- English-us (default)
- Spanish
- English-gb (Custom language)

March 20, 2024 at 11:02 am #15430555

Andreas W.
Supporter

Languages: English (English ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Yes, but you can not connect contents between these subsites.

WPML will only be able to handle contents on each subsite individually.

This means that you will not be able to translate content from Subsite 1 to Subsite 2, etc.

Was this the cause of the issue?

You tried to use:

SubSite1 - US
- English-us (default)

SubSite2 - Spain
- Spanish

SubSite3 - UK
- English-gb (Custom language)

If so, please take note, that this is not possible with WPML.

March 20, 2024 at 11:18 am #15430605

peteN

It sounds like the search will go on for a solution that works with WP Multisite.

If you are correct that each sub-site has no awareness of it's neighbouring sub-sites despite being on the same multisite network, then this article needs removing: https://wpml.org/documentation/support/multisite-support/

I will try and find an alternative plugin.

Appreciate your time Andreas.

Over and out.