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 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Europe/Tirane (GMT+02:00)

This topic contains 6 replies, has 2 voices.

Last updated by Marsel Nikolli 1 year ago.

Assisted by: Marsel Nikolli.

Author Posts
November 23, 2023 at 9:53 am #14905945

anil-kumarS

What does hreflang= x-default means? What is the use of it?

How can I remove this from my site, I have only three languages, English, french and Dutch, Eng is defalt, Attaching a screenshot of Language settings

I want to remove this hreflang= x-default line from my site, Attached a screenshot

x-default.jpg
wpml language settings.jpg
site languages.jpg
November 23, 2023 at 11:24 am #14907111

Marsel Nikolli

Hi,



Thank you for contacting WPML Support, I will be happy to help you today.

1) Here's an explanation for x-default:
hidden link

Also from Google:
hidden link

It's the value we set for the hreflang attribute of <link> for the most universal language of the site, that is when the site does not have a language matching the visitor's browser languages.

2) There is no built-in option on WPML to switch it on or off.

I hope that you will find this answer helpful, let me know if you have any other questions.

Kind regards,
Marsel

November 23, 2023 at 1:31 pm #14908545

anil-kumarS

Okay Got it, There is no option in WPML,

1) Can we remove x-default by Custom Code ?
2)Why this issue is happening? hreflang=en & hreflang=x-default both are pointing to same url ?

November 23, 2023 at 3:06 pm #14909565

Marsel Nikolli

This is not an issue as the x-default is a special hreflang attribute value that specifies where a user should be sent if none of the languages you’ve set in your other hreflang links match their browser settings. (That's particularly handy if you use our browser language redirect option).

Since your website default language is English, the hreflang=en & hreflang=x-default both will point to same URL.

*Please for more detailed information about hreflang refer the to the links I shared previously.

2) You could try the solution suggested on this ticket:
https://wpml.org/forums/topic/x-default-tag-in-our-page-how-to-skip-or-deactivate/#post-10437001

The code suggested on the ticket should be placed on your theme's functions.php file.

Note: Please make sure to have a full backup of your website before making any changes on your website.

Let me know if you have any more questions related to the issue.

Kind regards,
Marsel

November 24, 2023 at 6:28 am #14913255

anil-kumarS

That code is working for me, I have to make sure what are the cons of removing x-default, What will change after removing it? Will it affect my website critically ?

November 24, 2023 at 6:59 am #14913379

anil-kumarS

Also nl-nl this is my hreflnag for netherlands, and fr-be for belgium, I want the last two letters in capital, like nl-NL, fr-BE, In settings it's already in capital format, Attaching a screenshot, If not possible in wpml, Is there a custom code to reflect as nl-NL & fr-BE

Languages-‹-Zuci-Systems-—-WordPress.png
November 24, 2023 at 10:06 am #14915267

Marsel Nikolli

Hi,

1) Regarding your question on removing the x-default from your website:

X-Default Hreflang is a valuable tool in international SEO, and implementing it correctly can significantly benefit your website’s performance and user experience. I would suggest you consult with a SEO specialist for a more detailed explanation on the affect it has on your website.

Hreflang annotations are HTML attributes that tell search engines which language and region a particular webpage targets. This helps search engines to serve the most relevant content to users, regardless of their location.

2) According to Google's specifications, both language and region codes should be lowercase for `hreflang` annotations. That's why, country code(after language code) in hreflang appears in small case. The `hreflang` value "nl-nl" or "fr-be" is technically correct and should work.

Many websites and systems use the mixed case format (e.g., "fr-BE") with the country code in uppercase. Google, being aware of the common practice, has made its algorithms flexible enough to understand and accept both formats.

WPML is configured to render the hreflang attribute in lowercase only as it is recommended,
and I understand your preference, but unfortunately it is something not possible at the moment.

I hope you can understand and I hope this explanation helps.
Feel free to let me know if you need any further assistance. I will be happy to help.

Kind regards,
Marsel

The topic ‘[Closed] Remove x-default hreflang’ is closed to new replies.