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:
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.
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?
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.
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
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.
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.
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