This thread is resolved. Here is a description of the problem and solution.
Problem: If you're experiencing issues with unexpected hreflang tags such as 'en-gb' appearing on your site, even though you have only set up 'nl' and 'en-nl', and these tags are redirecting to the homepage causing errors, here's what we recommend. Solution: First, ensure that the hreflang tags on your site are correctly set up. You can check the current setup by inspecting the page source. Here's an example of what correct hreflang tags might look like:
If you find an incorrect hreflang tag, it might be due to caching or third-party plugins. We recommend clearing your site's cache and checking if any SEO tools or plugins could be generating these tags. Additionally, you can customize hreflang codes directly in the WPML settings for regional targeting. For more details, check the WPML documentation on adding hreflang in WordPress. If after these steps the issue persists, please provide screenshots from the SEO tool (like Screaming Frog) showing where the incorrect hreflang tag is detected.
If this solution does not resolve your issue or seems irrelevant due to being outdated or not applicable to your 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 needed, do not hesitate to open a new support ticket with us for further assistance 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.
Background of the issue:
I am trying to set up hreflang tags for two languages, Dutch and English, with the tags nl and en-nl. The issue can be seen on this page: hidden link.
Symptoms:
ScreamingFrog is reporting an unexpected html alternate hreflang 4 url en-gb that redirects everything to the homepage, causing errors due to incorrect return tags.
Questions:
How can I remove or configure the incorrect hreflang tag?
Why is there an en-gb hreflang tag when I only set up nl and en-nl?
So based on this output, there’s no sign of an `en-gb` hreflang tag on the live page.
To better understand what’s happening, could you please share screenshots from the SEO tool (Screaming Frog)? Specifically, it would be helpful to see where it’s detecting the `en-gb` tag and how it’s being reported. That way, we can narrow down whether the issue is with WPML’s output or possibly a cached or third-party-generated tag.
Just as a note: WPML generates hreflang tags automatically based on the site's language settings. You can also customize hreflang codes (for regional targeting, like `en-nl`) directly in the WPML settings if needed. Here's a reference from WPML’s documentation that explains how this can be done: https://wpml.org/documentation/support/adding-hreflang-wordpress/#regional-targeting
Once we have more info or a screenshot from Screaming Frog, we can dig further into what’s causing that `en-gb` tag to appear.
This hreflang would not come from WPML as we don't add the hreflangs at the end of the header, also if EN-GB is not activated in WPML->Languages->Edit languages, then we can assume it's not coming from the plugin.
Is it possible that custom code was manually added in the header.php ?
Please review your theme's header.php and scroll to the bottom right before it closes -> do you see the custom code?
Are there any other plugins that could possibly add the hreflang ?
This is my header.php, I have removed the line that I believe added the en-gb, but I still see it in the frontend. Do you confirm that it is indeed still there, even though I Removed it from the header.php?