Skip Navigation

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.

Sun Mon Tue Wed Thu Fri Sat
9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 - -
- - - - - - -

Supporter timezone: Asia/Yerevan (GMT+04:00)

This topic contains 9 replies, has 1 voice.

Last updated by Christopher Amirian 4 months, 1 week ago.

Assisted by: Christopher Amirian.

Author Posts
January 28, 2025 at 10:42 am #16641010

andreiV-9

Background of the issue:
I am trying to translate articles from EN to ES on our website blog. The issue can be seen on this page: hidden link. I expected to see:

<link rel="alternate" hreflang="en-us" href="hidden link" />
<link rel="alternate" hreflang="es-us" href="hidden link" />
<link rel="alternate" hreflang="x-default" href="hidden link" /> .

Symptoms:
The ES meta 'hreflang' value is wrong. Instead of the expected URL, I got:

<link rel="alternate" hreflang="en-us" href="hidden link" />
<link rel="alternate" hreflang="es-us" href="hidden link" />
<link rel="alternate" hreflang="x-default" href="hidden link" />

Questions:
Why is the ES meta 'hreflang' value incorrect?
How can I correct the 'hreflang' URL for the ES translation?

January 29, 2025 at 9:10 am #16645140

Waqas Bin Hasan
WPML Supporter since 05/2014

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Thank you for contacting the support. Meanwhile this ticket is attended by one of my colleagues, can you please add a WPML Language Switcher to the site and see what URLs it provides for the default language and the translated ones? Please also compare these URLs by opening the translation of the page.

I see that you're using a link for the alternate language version, which is probably having a hand-crafted link. While, the hreflangs are produced based on the languages added in the site and WPML Language Switcher follows it to provide correct references.

If language switcher matches the produced hreflangs in site source code, then probably the issue is somewhere else.

Besides this, I'll also recommend upgrading WordPress to the latest version. Since you're using latest WPML plugins, it is better to update WP for compatibility improvements.

IMPORTANT: Please take full backup of your website and database beforehand. 

It is highly advised to try this on a staging/dev site first, so your live website isn't compromised.

Please let us know your findings and we'll try our best to help you further on the matter.

Regards.

January 29, 2025 at 11:51 am #16646065

andreiV-9

Hi Waqas, thanks for looking into this for me. I've added the default language switcher (please see screenshot) and the result is the same.

Would this have something to do with the fact that the ES blog version permalink is using /news/ instead of /noticias/? I cannot find a way to update the permalink structure for all posts that are being translated into Spanish.

image (24).png
January 30, 2025 at 1:16 pm #16651789

Christopher Amirian
WPML Supporter since 07/2020

Languages: English (English )

Timezone: Asia/Yerevan (GMT+04:00)

Hi,

Thank you for the information, I will continue with this ticket.

I checked the website and it seems the HREFLANG is generated correctly.

I recorded a video to show you what I see:

hidden link

Thanks.

January 31, 2025 at 11:32 am #16655178

andreiV-9

Hi Christopher,

I'm checking the same article as you and it seems the href lang meta is still wrong.

hidden link

Here's a recording I did moments ago: hidden link

January 31, 2025 at 11:35 am #16655185

andreiV-9

Here's another example: hidden link

February 2, 2025 at 3:36 pm #16660215

Christopher Amirian
WPML Supporter since 07/2020

Languages: English (English )

Timezone: Asia/Yerevan (GMT+04:00)

Hi,
Thanks, unfortunately the video you have mentioned does not work. For the second link you shared I see the attached image for HREFLANG.

Would you please type what other link you expect to see for HREFLANG?

I need to know what is your expectations as the one I see seems to be standard and what WPML does.

Thanks.

Screenshot 2025-02-02 at 7.35.51 PM.png
February 3, 2025 at 10:01 am #16662056

andreiV-9

Hi Cristopher, I expect the values of "href" to be the EN link, not the ES.

For example, these are the lines that I expect to be generated instead of the ones seen in your screenshot. Please compare and observe that we need the EN links under the "en-us" and the "x-default".

<link rel="alternate" hreflang="en-us" href="hidden link" />
<link rel="alternate" hreflang="es-us" href="hidden link" />
<link rel="alternate" hreflang="x-default" href="hidden link" />

Thank you very much !

February 3, 2025 at 10:07 am #16662131

andreiV-9

Here's an explanatory screenshot

Screenshot 2025-02-03 120503.jpg
February 3, 2025 at 1:34 pm #16663045

Christopher Amirian
WPML Supporter since 07/2020

Languages: English (English )

Timezone: Asia/Yerevan (GMT+04:00)

Hi,

Thank you very much, Your explanation gave me an idea what might be the problem cause.

You use the Rank Math SEO plugin that requires our WPML SEO plugin for compatibility.

- IMPORTANT STEP! Create a backup of your website. Or better approach will be to test this on a copy/staging version of the website to avoid any disruption of a live website.
- Please go to WP Dashboard > Plugins > Add New > Commercial (tab)
- Select WPML SEO and click the Download button while the Activate checkbox is checked.

That should fix the issue. For more information:

https://wpml.org/documentation/plugins-compatibility/optimize-multilingual-websites-using-rank-math-and-wpml/

If the issue persists, I'd appreciate it if you could test in a minimal environment:

- IMPORTANT STEP! Create a backup of your website. Or better approach will be to test this on a copy/staging version of the website to avoid any disruption of a live website.
- Switch to the default theme such as "TwentyTwenty" by going to "WordPress Dashboard > Appearance > themes".
- Go to "WordPress Dashboard > Plugins" and deactivate all plugins except WPML and its add-ons.
- Check if you can still recreate the issue.
- If not, re-activate your plugins one by one and check the issue each time to find out the plugin that causes the problem.

Thanks.

The topic ‘[Closed] Wrong ‘hreflang’ meta URL’ is closed to new replies.