Skip Navigation

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:

<link rel="alternate" hreflang="en-nl" href="https://www.yoursite.com/page/" /><br /><link rel="alternate" hreflang="nl" href="https://www.yoursite.com/nl/page/" /><br /><link rel="alternate" hreflang="x-default" href="https://www.yoursite.com/page/" />

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.

Tagged: 

This topic contains 5 replies, has 1 voice.

Last updated by Bobby 3 weeks, 3 days ago.

Assisted by: Bobby.

Author Posts
April 10, 2025 at 5:13 pm #16920056

steefB-2

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?

April 14, 2025 at 12:43 pm #16929515

Bruno Kos
WPML Supporter since 12/2018

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+02:00)

Hi,

Thanks for the detailed explanation.

From what I can see on the page you linked — hidden link — the current hreflang setup looks correct:

<link rel="alternate" hreflang="en-nl" href="<em><u>hidden link</u></em>" />
<link rel="alternate" hreflang="nl" href="<em><u>hidden link</u></em>" />
<link rel="alternate" hreflang="x-default" href="<em><u>hidden link</u></em>" />

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.

Looking forward to your update!

April 18, 2025 at 6:31 am #16946278

steefB-2

Hey Bruno,
Thanks for your reply!
I do find the hreflang also on the live page (search for en-gb).
Hope that helps in resolving the issue.
Steef

Screenshot 2025-04-18 at 08.29.32.png
April 18, 2025 at 4:18 pm #16947809

Bobby
WPML Supporter since 04/2015

Languages: English (English )

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

Hi there,

I was able to locate the en-gb hreflang.

<link rel="alternate" href="hidden link" hreflang="en-gb" />

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 ?

April 24, 2025 at 12:15 pm #16964168

steefB-2

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?

<?php
/**
* The header for Astra Theme.
*
* This is the template that displays all of the <head> section and everything up until <div id="content">
*
* @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
*
* @package Astra
* @since 1.0.0
*/

if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}

?><!DOCTYPE html>
<?php astra_html_before(); ?>
<html <?php language_attributes(); ?>>
<head>
<?php astra_head_top(); ?>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<?php
if ( apply_filters( 'astra_header_profile_gmpg_link', true ) ) {
?>
<link rel="profile" href="hidden link">
<?php
}
?>
<?php wp_head(); ?>
<?php astra_head_bottom(); ?>
</head>

<body <?php astra_schema_body(); ?> <?php body_class(); ?>>
<?php astra_body_top(); ?>
<?php wp_body_open(); ?>

<a
class="skip-link screen-reader-text"
href="#content"
role="link"
title="<?php echo esc_attr( astra_default_strings( 'string-header-skip-link', false ) ); ?>">
<?php echo esc_html( astra_default_strings( 'string-header-skip-link', false ) ); ?>

<div
<?php
echo astra_attr(
'site',
array(
'id' => 'page',
'class' => 'hfeed site',
)
);
?>
>
<?php
astra_header_before();

astra_header();

astra_header_after();

astra_content_before();
?>
<div id="content" class="site-content">
<div class="ast-container">
<?php astra_content_top(); ?>

April 24, 2025 at 7:53 pm #16966160

Bobby
WPML Supporter since 04/2015

Languages: English (English )

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

Thank you for updating me!

I have taken a look at your site's source and I no longer see the en-gb hreflang.