Zum Inhalt springen Zur Seitenleiste springen

Dieses Thema ist gelöst. Hier finden Sie eine Beschreibung des Problems und der Lösung.

Problem:
Sie versuchen, hreflang-Tags in Ihren Sitemaps mit WPML zu verwalten. Trotz der Einstellungsänderung in WPML unter 'Languages - SEO Options' zu 'Display alternative languages in the HEAD section' bleiben die hreflang-Strukturen in der Sitemap erhalten.
Solution:
Um die hreflang-Tags aus der Sitemap zu entfernen, fügen Sie bitte folgenden Code in Ihre functions.php Datei ein:

define('WPML_SEO_ENABLE_SITEMAP_HREFLANG', false);

Weitere Informationen finden Sie in unserer Dokumentation: Using WordPress SEO with WPML.
Bitte stellen Sie sicher, dass Sie vor der Anwendung dieser Änderungen ein vollständiges Backup Ihrer Website erstellen.

Falls diese Lösung veraltet ist oder nicht auf Ihr Problem zutrifft, empfehlen wir Ihnen, ein neues Support-Ticket zu öffnen. Wir empfehlen auch, die Seite mit bekannten Problemen (https://wpml.org/known-issues/) zu überprüfen, die Version der dauerhaften Lösung zu verifizieren und zu bestätigen, dass Sie die neuesten Versionen von Themes und Plugins installiert haben.

Dies ist das technische Support-Forum für WPML – das mehrsprachige WordPress-Plugin.

Mitlesen können alle, doch nur WPML-Kunden können hier Fragen veröffentlichen. Das WPML-Team antwortet im Forum an 6 Tagen pro Woche, 22 Stunden am Tag.

Dieses Thema enthält 4 Antworten, hat 0 Stimmen.

Zuletzt aktualisiert von thomasB-203 Vor 1 Tag, 6 Stunden.

Assistiert von: Lucas Vidal de Andrade.

Autor Beiträge
Juli 28, 2025 um 11:42 am #17274719

thomasB-203

Hintergrund des Themas:
I am trying to manage hreflang tags in my sitemaps using WPML. Since the last updates, WPML writes hreflang into the sitemaps like this: , , . I changed the setting in WPML - Languages - SEO Options to 'Display alternative languages in the HEAD section.' However, the hreflang structure still remains in the sitemap. How can I omit that? The issue can be seen at: versteckter Link.

Die Symptome:
The hreflang data remains in the sitemap despite changing the setting to 'Display alternative languages in the HEAD section.'

Fragen:
How can I remove hreflang tags from the sitemap after changing the setting to display them in the HEAD section?

Juli 28, 2025 um 12:21 pm #17274998

Lucas Vidal de Andrade
WPML-Unterstützer seit 11/2023

Sprachen: Englisch (English ) Spanisch (Español ) Deutsch (Deutsch ) Portugiesisch, Brasilien (Português )

Zeitzone: America/Sao_Paulo (GMT-03:00)

As I said, I'm going to get a second opinion with our devs, if that can be disabled via WPML interface, or if we have any workaround. I'll get back to you, thank you.

Juli 28, 2025 um 12:23 pm #17275002

thomasB-203

Lucas,
you suddenly closed the chat!?
Once again: It has nothing to do with Yoast!
When WPML SEO is active then hreflang tags are written into the sitemaps. You're right that Yoast creates sitemaps but WPML SEO is adding data there like:
<xhtml:link rel="alternate" hreflang="en" href="versteckter Link" />
<xhtml:link rel="alternate" hreflang="de" href="versteckter Link" />
<xhtml:link rel="alternate" hreflang="x-default" href="versteckter Link"
When I deactivate the plugin WPML SEO then this code lines are not there.
So it's proven that this is written by the WPML SEO plugin.
The data should not be written at all into the sitemaps when the WPML SEO option "Display alternative languages in the HEAD section" is activated. This option is in WPML - Languages - SEO Options
hreflang should not be defined twice. It must be either in head or in sitemap

Juli 28, 2025 um 7:55 pm #17276648

Lucas Vidal de Andrade
WPML-Unterstützer seit 11/2023

Sprachen: Englisch (English ) Spanisch (Español ) Deutsch (Deutsch ) Portugiesisch, Brasilien (Português )

Zeitzone: America/Sao_Paulo (GMT-03:00)

Hey there,

I actually moved the chat into our support Forum, so I could get a second opinion on the issue. I still haven't received an answer, and will get back to you as soon as I have one. Thank you for your patience.

I understand that WPML impacts the sitemap, that's precisely why I'm escalating the issue.

Juli 29, 2025 um 2:49 pm #17279562

Lucas Vidal de Andrade
WPML-Unterstützer seit 11/2023

Sprachen: Englisch (English ) Spanisch (Español ) Deutsch (Deutsch ) Portugiesisch, Brasilien (Português )

Zeitzone: America/Sao_Paulo (GMT-03:00)

Hello there,

Thank you for waiting. I've checked with our devs. You can disable the hreflangs on the sitemap, by adding this to your functions.php file:

define( 'WPML_SEO_ENABLE_SITEMAP_HREFLANG', false );

It's in our documentation as well:
https://wpml.org/documentation/plugins-compatibility/using-wordpress-seo-with-wpml/#create-multilingual-sitemaps

Make sure to have a full website backup, before applying any of the suggestions shared here. That should solve your issue. Let me know if you have any other questions.

August 1, 2025 um 8:40 am #17287297

thomasB-203

Hi Lucas,
thank you!
You wrote: by adding this to your functions.php file
This didn't work but I found in the documentation you gave me:
adding the following code to your wp-config.php
and now it works perfectly.
Best regards,
Thomas