Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
You are using the WPML SEO plugin and have noticed that HREFLANG tags are not being automatically added to the HTML head section of your site.
Solution:
We have updated the WPML SEO plugin to version 2.2.0, which now includes HREFLANG tags directly in the sitemaps instead of the HTML head section. This change improves SEO by simplifying your site's HTML. You can confirm that the HREFLANG tags are correctly implemented in your sitemaps by checking your site's page source. For more details on this update, please visit WPML SEO 2.2.0 documentation.

If this solution does not apply to your case, or if it seems outdated, we recommend opening a new support ticket. We also highly suggest 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. For further assistance, please visit our support forum 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.

Tagged: 

This topic contains 9 replies, has 0 voices.

Last updated by Andrey 6 days, 23 hours ago.

Assisted by: Andrey.

Author Posts
June 25, 2025 at 1:15 pm #17169395

Kristof

Background of the issue:
I am trying to use the WPML SEO plugin to automatically add HREFLANG tags to my site, hidden link.

Symptoms:
HREFLANG tags are not being added automatically by the WPML SEO plugin.

Questions:
Why are HREFLANG tags not being added automatically by WPML SEO?
How can I ensure that WPML SEO adds HREFLANG tags to my site?

June 25, 2025 at 5:29 pm #17170514

Andrey
WPML Supporter since 06/2013

Languages: English (English ) Russian (Русский )

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

Thank you for contacting WPML support.

Could you please provide screenshots illustrating the issue so I can better understand what’s happening?

Also, does the problem persist if you temporarily deactivate all plugins except WPML? If possible, please also test using a default WordPress theme.

Before making any changes, please ensure that you have a full backup of your database.

June 26, 2025 at 8:13 am #17171874

Kristof

Please visit hidden link and search the source code for HREFLANG, I can't find it, it should be there.

I have tested on a staging with only WPML plugin and 2025 Theme, same issue.

June 26, 2025 at 2:45 pm #17174309

Andrey
WPML Supporter since 06/2013

Languages: English (English ) Russian (Русский )

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

I need to request temporary access (wp-admin and FTP) to your site—preferably to a test site where the problem has been replicated if possible—in order to be of better help. When you log in to leave your next reply, you will find the needed fields below the comment area. The information you will enter is private, meaning only you and I can see and access it.

If I need to debug the problem further, I would like to ask about the possibility of replicating your site locally. I'll need to install a "Duplicator" temporarily or an "All In One Migration" plugin on your site. This will enable me to create a duplicate of your site and its content. If you prefer to do it independently, you can provide the snapshot and send me the zipped package you downloaded.

Please let me know your thoughts on this.

June 28, 2025 at 5:30 pm #17179579

Andrey
WPML Supporter since 06/2013

Languages: English (English ) Russian (Русский )

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

Thank you for your feedback.

I have reviewed the problem you reported, and this is now expected behavior with the latest update of WPML SEO 2.2.0. Let me explain.

Alternative Languages (hreflangs) Tags in Sitemaps

We’ve added alternative language (hreflang) tags directly into sitemaps.

This improves SEO and simplifies your site’s HTML, as pages no longer need hreflang tags in the <head> section.

Have a look here for more details:
https://wpml.org/compatibility/2025/06/wpml-seo-2-2-0/

I have double-checked, and the hreflang tags are present in your site in the sitemaps. I have attached a screenshot for your review. Alternatively, you can check it hidden link">here.

Screenshot 2025-06-28 at 20.24.14.png
June 30, 2025 at 6:53 am #17181363

Kristof

I don't see this HREFLANG on the live site view-source:hidden link

June 30, 2025 at 9:30 am #17182493

Andrey
WPML Supporter since 06/2013

Languages: English (English ) Russian (Русский )

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

Please update WPML SEO plugin to v 2.2.1.

You can check the latest released versions under "My Account -> Downloads" on this site. Instructions to update can be found here: http://wpml.org/faq/install-wpml/

If you do not see the updates, you might need to click the Check for updates button in the Plugins → Add New Plugin → Commercial tab.

If the issue persists after an update has been done, please compare your staging site and live, as I can see the hreflangs there. I only had to update the WPML SEO plugin there.

Please remember to back up your database before you proceed.

July 1, 2025 at 7:56 am #17186988

Kristof

I have updated the WPML SEO plugin, but it still does not fix the problem.
If you only updated the plugin yourself, than live and staging should be exactly the same. I have pushed live to staging again to update the staging.

The difference I see:
on staging:
<urlset xmlns:xsi="hidden link" xmlns:image="hidden link" xsi:schemaLocation="hidden link hidden link hidden link hidden link" xmlns="hidden link" xmlns:xhtml="hidden link">

vs live:
<urlset xmlns:xsi="hidden link" xmlns:image="hidden link" xsi:schemaLocation="hidden link hidden link hidden link hidden link" xmlns="hidden link">

I know the difference is small, but there shouldn't be ANY difference, staging is an exact copy.

July 1, 2025 at 8:27 am #17187231

Andrey
WPML Supporter since 06/2013

Languages: English (English ) Russian (Русский )

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

Thank you for the details.

I have re-examined the link hidden link, comparing it to the staging site, and it is missing the pages.

Please try to go to Rank Math using Rank Math’s WordPress menu. Hover over the menu with your mouse, and then click the Sitemap Settings. Check if nothing is missing.

If the issue persists, I would need access to your live site. I am not certain why it doesn't work on the live site. The following reply is private.

July 1, 2025 at 9:58 am #17187680

Kristof

You have pointed me in the right direction, I have changed a settings in RankMath, to not include images, and that must have triggered the recreation of the sitemaps, WITH the hreflangs. I enabled index images, and the sitemap still showed the hreflangs.

I think the issue is now resolved.

July 1, 2025 at 10:46 am #17188018

Andrey
WPML Supporter since 06/2013

Languages: English (English ) Russian (Русский )

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

Thanks. I'm glad it works now! Have a nice week 🙂