This thread is resolved. Here is a description of the problem and solution.
Problem: The client needed to adjust hreflang tags for
different regional versions of their website. Specifically, they wanted to
change 'en-usa' to 'en-us' and set regional codes like 'en-x-emea' and
'en-x-apac'. Additionally, they encountered issues where changes were not being
saved and received an error stating 'The hreflang already exists.'. Solution:
We advised that the hreflang formats like 'en-x-emea' or 'en-x-apac' can be set from WPML -> Languages by adjusting the hreflang as needed.
To resolve the issue of the hreflang not saving (because the Enlgish language was used before, and as a result the hreflang "en-us" was already set to it), we suggested:
1. Activate the default English language on WPML -> Languages.
2. Change the hreflang for the default English language if it was previously set to 'en-us'.
3. Save the changes.
4. Attempt to change the hreflang from 'en-usa' to 'en-us' again and save.
5. Remove the default English language on WPML -> Languages if no longer needed.
This process helped in correctly setting up the desired hreflang tags. If these steps do not resolve your issue or if the solution seems outdated, we recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If problems persist, please open a new support ticket at 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 have a few issues with hreflang tags. I'm sure I'm just missing something in the settings, but I can't figure it out myself.
1. I need to change the hreflang for the North America version (hidden link) from en-usa to en-us. I tried doing that on the languages settings page (see attached screenshot) but it doesn't save. After I click the Save button, the page refreshes and the hreflang is still en-usa.
2. Because we're targeting regions instead of countries, my SEO consultant recommended changing the hreflang for the EMEA (hidden link) and APAC (hidden link) sites. How can I change the hreflang to "en-x-emea" and "en-x-apac" respectively? In the same spot as the screenshot?
3. My SEO consultant also said the hreflang="x-default" should be self-referencing. In other words, when I'm on hidden link the tag should be this:
<link rel="alternate" hreflang="x-default" href="hidden link" />
It's currently this:
<link rel="alternate" hreflang="x-default" href="hidden link" />
The x-default should be the North America site because I'm in the United States.
I'm somewhat confused by hreflang, so please let me know if any of this doesn't make sense. Thank you!
Thank you for contacting WPML Support, I will gladly help you.
The standard way how the hreflang attribute is added to the website is hreflang=”de-DE”. Where "de" is the country code and "DE" is the language value.
As per my knowledge you can't use the format "en-x-emea" or "en-x-apac" as a hreflang.
More information can be found in: hidden link
* On the attached image are shown your actual hreflang attributes.
I got a little more clarity from my SEO consultant. She said that en-x-emea is valid as a regional tag, which is different from a country code. Country codes are better than regional codes for SEO, but my client decided to go the regional route.
Does WPML support regional codes? If not, that goes back to my question from a little while ago: Is it possible to turn off the hreflang that WPML provides?
I understand the situation, and you should be able to set "en-x-emea" from WPML -> Languages, by changing the hreflang as needed without problems (section marked in the attached image).
* If you still keep having the issue when saving the WPML -> Languages -> Edit Languages
the page just refreshes and doesn't save anything, let me know.
Thank you! I was able to set the en-x-* hreflang for the two regions I wanted. However, when I try to change en-usa to en-us, the page just refreshes (after I hit save) and the hreflang goes back to en-usa.
From the debug info I've noticed that you are using WP v6.4.3, I suggest you update to the latest version.
Also, according to your debug.info, the WP memory limit needs to be increased, WordPress uses 40Mb as default and the minimum requirements for WPML are 128 MB. (Kindly check this page: https://wpml.org/home/minimum-requirements/)
You can increase it by adding the following code in your wp-config.php file right before the line: /* That's all, stop editing! Happy publishing. */
I noticed something I didn't see before--when I try to change en-usa to en-us, I get a "The hreflang already exists." error.
I think this part of the issue is related to something I've been working on in another support thread: https://wpml.org/forums/topic/sitemap-showing-non-existent-pages/ Not sure if you want to close this one out, since you were able to help me with the other hreflang tags.
Yes, I believe I did use it previously. Because my client wanted 3 different "versions" of English, I had some issues setting it up initially. I think I created an en-us hreflang previously. How do I remove it?
Thank you for the access, I was able to check and it should be set correctly. What I did was:
- activate the default English language on WPML -> Languages
- changed the hreflang for the default English language (as it was set to "en-us")
- saved the changes
- after, I changed the hreflang from en-usa to en-us
- saved the changes
- removed the default English language on WPML -> Languages
Please check and let me know if you have any questions or issues.
I can see that it's fixed on dev. What I don't understand is how to activate the default English language on WPML -> Languages. Can you give me directions on how to do that? I'm probably missing something obvious. 🙂
Oh, wait, I figured it out! In case it's helpful for anyone else (or if I need a reminder in the future)
1. Go to WPML -> Languages
2. Click Add / Remove Languages button
3. Select English and click Save
4. Click Edit Languages link
5. Adjust the hreflangs as needed