Skip Navigation

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

Problem:
The client is experiencing hreflang conflicts when auditing their site with SEMRush, specifically issues with missing self-referencing hreflang tags and incorrect hreflang attributes for pages created with custom code. They are using WPML and SEOPress Pro.
Solution:
We recommended ensuring that the option to display alternative languages in the HEAD section is checked and set to 'as early as possible' in WPML->Languages->SEO options. This setting helps WPML to manage hreflang tags automatically. For more detailed guidance on managing hreflang with WPML, visit General Documentation on WPML & Hreflangs.
If these settings do not resolve the issue, or if the hreflang tags need specific adjustments due to custom-coded pages, we may need to investigate further by requesting temporary access to the site to diagnose the issue directly.

Please note that the solution provided might be outdated or not applicable to your specific case. We highly 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 the problem persists, please open a new support ticket.

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

Last updated by Bobby 6 months, 2 weeks ago.

Assisted by: Bobby.

Author Posts
July 8, 2024 at 5:54 pm #15914678

adrienR-5

Background of the issue:
When doing an audit with SEMRush, I have thousands of hreflang conflicts within page source code. I'm using WPML and SEOPress Pro as SEO plugin.

Symptoms:
No self-referencing hreflang (If your page doesn’t contain a self-referencing hreflang in its set of hreflang attributes, those attributes may be ignored or interpreted incorrectly. Include this page’s URL and language code in your set of hreflang attributes.)

Questions:
How can I solve the hreflang conflicts within the page source code using WPML and SEOPress Pro?

July 8, 2024 at 7:24 pm #15915441

adrienR-5

Another question: how can I modify the hreflang alternate that WPML is producing on the pages?

I have some dynamic pages that I created thanks to a custom code snippet and I would like to myself modify each one of their hreflang alternate links.

July 8, 2024 at 8:41 pm #15915603

Bobby
Supporter

Languages: English (English )

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

Hi there,

When I examine your site's source it looks as expected.

The hreflang is self referenced and x-default is set as well.

However, when I run a checker I do get the same errors as you get from Semrush regarding

Missing Self-Referencing Hreflang Annotation

If you review their documentation on #1 for this error and your site's source you will notice that the hreflang does indeed self-reference OK

hidden link

<link rel="alternate" hreflang="fr" href="hidden link" />
<link rel="alternate" hreflang="en" href="hidden link" />
<link rel="alternate" hreflang="es" href="hidden link" />
<link rel="alternate" hreflang="it" href="hidden link" />
<link rel="alternate" hreflang="nl-be" href="hidden link" />
<link rel="alternate" hreflang="x-default" href="hidden link" />

Where I do see an issue is the secondary language's and their source.
view-source:hidden link

For example /ES/ is missing the heflang.

-----------------------------------------------------

Please go to WPML->languages-> SEO options-> Display alternative languages in the HEAD section.=> make sure it's checked and set to as early as possible.

General Documentation on WPML & Hreflangs and how we add them automatically

July 8, 2024 at 9:00 pm #15915639

adrienR-5

Hello Bobby,

I have already the setting as "As early as possible" and the checkbox above checked.

I tried unchecking and switching to the other option and revert back to what is is, but now I don't have any alternate at all, just <meta property="og:locale:alternate" ...> is this normal?

markuphero-gRU8CuhLC31UC1yuBFmk.png
July 8, 2024 at 9:56 pm #15915757

Bobby
Supporter

Languages: English (English )

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

Thank you for updating me!

No that is not expected behavior.

I would like to request temporary access (wp-admin and FTP) to your site to test the issue.
(preferably to a test site where the problem has been replicated if possible)

**Before we proceed It is necessary to take FULL BACKUP of your database and your website. Providing us with access, you agree that a backup has been taken **

I often use the Duplicator plugin for this purpose: http://wordpress.org/plugins/duplicator/
You will find the needed fields for this below the comment area when you log in to leave your next reply.
The information you enter is private which means only you and I have access to it.

NOTE: If access to the live site is not possible and the staging site does not exist please provide me with a duplicator package created with the duplicator plugin.

Thank you,
Bobby

July 9, 2024 at 9:05 pm #15923309

Bobby
Supporter

Languages: English (English )

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

Thank you for providing me with the export file, unfortunately it get stuck at around 18% and will not finish.

Also, migrating the site to our cloudways environment is impossible due to it's size (40Gb), as well as creating a duplicator package even when removing uploads, etc to lower the size.

Is it possible for us to do some tests on the live site? A recent backup would be required, or do you happen to have a staging site available.

My theory is that a third party plugin is causing this issue but to locate it we need to test by activating/deactivating plugins and see which one is the offender.

July 10, 2024 at 12:16 am #15923807

adrienR-5

I tested everything and the issue arise when SEOPress has the module "Titles & Metas" activated, I don't know why, I contacted them.

Are you 100% compatible with SEOPress from your side?

I see that you have a WPML SEO addon for Yoast and Rank Math, is something missing from SEOPress Pro?

July 10, 2024 at 10:59 pm #15930444

Bobby
Supporter

Languages: English (English )

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

Hi there,

Thank you for updating me with your findings!

SEOpress is compatible with WPML

https://wpml.org/plugin/seopress/

https://wpml.org/documentation/plugins-compatibility/optimize-wpml-multilingual-sites-for-search-engines-using-seopress/#translating-global-SEO-texts

I have created a sandbox to do a quick test but it is working as expected.
hidden link

Would you mind using the link above and uploading the PRO version, possibly there is an issue between WPML + PRO

July 21, 2024 at 6:23 am #15982651

adrienR-5

Hi Bobby,

Sorry I thought I replied to you, the pro version is uploaded on your sandbox since couple of days.

Regarding the missing alternate, it was because those page were in noindex in SEOPress, it's solved now.

So the main issue is still on, I want to solve all those ahrefs warning, how can I do that?

Let me know please.

For example, for this URL: hidden link

No self-referencing hreflang (If your page doesn’t contain a self-referencing hreflang in its set of hreflang attributes, those attributes may be ignored or interpreted incorrectly.
Include this page’s URL and language code in your set of hreflang attributes.)

Do I need to update the self-referencing hreflang to be the permalink with URL parameter so the warning is gone? If so, what can I use for hooks and filters from WPML to do it?

Thanks!

July 22, 2024 at 5:48 pm #15988360

Bobby
Supporter

Languages: English (English )

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

Hi there,

Thanks for the update!

I'm glad to hear the issue with the missing alternate tags, due to pages being set to noindex in SEOPress, has been resolved. This should also clear up the warnings you were receiving from Ahrefs.

I conducted a quick check using the Ahrefs Chrome tool, and everything appears to be in order now. The check is passing, and the source code looks correct, which wasn't the case previously for all secondary languages due to missing hreflangs.

Regarding the page hidden link it shows correctly except for English. Could English possibly be set to noindex? (Please refer to the screenshot provided.)

For the URL hidden link, you might see some warnings because it doesn’t reference back due to the parameter, even in French, which is the default language. This suggests that the issue persists regardless of WPML's presence.

This situation likely relates to how additional content is loaded. I'm unsure if this type of URL, which loads more content, needs to be indexed by Google—for example, the URL mentioned above.

Note: When visiting this URL (hidden link) the source code will not reference the parameter so it looks like the main URL is actually failing the check but it is not.

Screen Shot 2024-07-22 at 10.39.21 AM.png
July 22, 2024 at 6:01 pm #15988432

adrienR-5

Hi Bobby,

Yes the /articles/ English version was set to noindex, it was added just today, it's now corrected.

For the links with URLs parameters I would like to change the alternate x-default tag, which hook or filter from WPML I need to use for that?

Thanks!

July 22, 2024 at 7:13 pm #15988851

Bobby
Supporter

Languages: English (English )

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

There is this hook you might find useful https://wpml.org/wpml-hook/wpml_alternate_hreflang/ , but I will note again that this is something that would happen even without WPML present and is not related to WPML or its code.

I would recommend reaching out to the theme or plugin developers regarding this parameter structure and ahref warning.

My response in this thread might also be relevant, however, there is no way from our team to manually change this:
https://wpml.org/forums/topic/how-to-assign-hreflang-x-default-to-root-instead-to-default-language/

July 22, 2024 at 8:15 pm #15989139

adrienR-5

WPML is the one output the alternate tag in all languages, no?

So WPML doesn't put the right x-default and doesn't take into account URL parameters, so I would have to do it myself, it's not an issue if you provide the hook.

So thanks, I'll try and see if it's working.

July 22, 2024 at 11:52 pm #15989638

Bobby
Supporter

Languages: English (English )

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

Go to hidden link

Right-click , view source -> notice the following (It's Correct, this generates no errors):

<link rel="alternate" hreflang="fr" href="<em><u>hidden link</u></em>" />
<link rel="alternate" hreflang="en" href="<em><u>hidden link</u></em>" />
<link rel="alternate" hreflang="es" href="<em><u>hidden link</u></em>" />
<link rel="alternate" hreflang="it" href="<em><u>hidden link</u></em>" />
<link rel="alternate" hreflang="fr-be" href="<em><u>hidden link</u></em>" />
<link rel="alternate" hreflang="nl-be" href="<em><u>hidden link</u></em>" />
<link rel="alternate" hreflang="fr-ca" href="<em><u>hidden link</u></em>" />
<link rel="alternate" hreflang="x-default" href="<em><u>hidden link</u></em>" />

Now go back to hidden link and paginate to page 2.

The URL will be this : hidden link

Right-click , view source -> notice the following :
view-source:hidden link

The parameter is dropped. The FR language alone has the wrong alternate pointing.

<link rel="alternate" hreflang="fr" href="<em><u>hidden link</u></em>" />
<link rel="alternate" hreflang="en" href="<em><u>hidden link</u></em>" />
<link rel="alternate" hreflang="es" href="<em><u>hidden link</u></em>" />
<link rel="alternate" hreflang="it" href="<em><u>hidden link</u></em>" />
<link rel="alternate" hreflang="fr-be" href="<em><u>hidden link</u></em>" />
<link rel="alternate" hreflang="nl-be" href="<em><u>hidden link</u></em>" />
<link rel="alternate" hreflang="fr-ca" href="<em><u>hidden link</u></em>" />
<link rel="alternate" hreflang="x-default" href="<em><u>hidden link</u></em>" />
July 24, 2024 at 5:00 pm #15999713

adrienR-5

Hi Bobby,

I removed completely the alternate tags whenever I'm on a page with WPGB facets, since a page 2 of the blog post page of IT for example, is not equal to the page 2 of the blog post index page in other languages.

Since each languages have their own posts I don't think it's right to have alternate on those pages.

Hopefully it will fix all those SEMrush warning.

I'll see on the next SEMRush audit we run.