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 4 replies, has 2 voices.

Last updated by Mihai Apetrei 12 months ago.

Assigned support staff: Mihai Apetrei.

Author Posts
October 19, 2018 at 3:12 pm #2832534

damienB-2

I am trying to: I want to implement hreflang en-gb and en-us on my site and I can't manage to do it! Can you tell me how to install properly both hreflang please? I want the default hidden link to be en-us and hidden link to be en-gb. I followed your link and explanation but WP refuses to have the same code language (en) twice...

Link to a page where the issue can be seen:

I expected to see:

Instead, I got:

October 19, 2018 at 4:12 pm #2832645

Mihai Apetrei
Supporter

Languages: English (English )

Timezone: Europe/Bucharest (GMT+03:00)

Hi and thank you for contacting WPML Support!

I will be happy to help you with this.

You can change the hfreflang used on your site from WPML > Languages > and click "Edit languages"

Here is some really helpful documentation for that:
https://wpml.org/documentation/support/adding-hreflang-wordpress/#check-your-hreflang-settings-and-make-sure-they-are-as-you-intend-them-to-be

Please let me know if this solved your issue or if you still need help.

I will be waiting for your response.

Kind regards,
Mihai

October 20, 2018 at 8:24 am #2833937

damienB-2

Hi Mihai,

First of all, thank you for your answer.

I know that I have to go to WPML > Languages > and click "Edit languages". In fact, that's when I'm there that I have my problem!

So, when I'm there, how can I implement two hreflang for the same language.

For example: language "en" and hreflang "en-us" and "en-gb"

OR language "fr" and hreflang" fr-fr" and "fr-ca"?

Your system seems to refuse it because the language code is the same!

Looking forward to hearing from you.

Damien

October 20, 2018 at 6:41 pm #2834570

damienB-2

Hi Mihai,
I'm not sure you had my answer saying that my problem wasn't solved.
Can you please confirm?
Kind regards.
Damien

October 22, 2018 at 2:38 pm #2838471

Mihai Apetrei
Supporter

Languages: English (English )

Timezone: Europe/Bucharest (GMT+03:00)

Hi Damien.

Sorry, it was not clear for me that you wanted to use the same hreflang tag for the same language as I've seen those different links that you mentioned (the "/" and "/uk").

Is there a specific reason why you would like to use the same hreflang for the same language?

That's achievable by using this filter:

$hreflang_items = apply_filters( 'wpml_hreflangs', $hreflang_items )

However, if you want to use this for language variation purposes, a better approach would be to create them as custom languages and the hreflangs will be generated automatically.

Here you can find more about this:
https://wpml.org/documentation/support/editing-wpmls-languages-table/

Please let me know if this solved your issue or if you still need help.

I will be waiting for your response.

Kind regards,
Mihai