-
Hi, we use rankmath and wpml. Sitemaps are configured in rankmath.
I do not understand why in the main sitemap I can find both default language (german) and english items.
Also in the english version of the sitemap there are links that are just plain wrong and do not exist, leading to many 404 errors and probably hurting rankings as they are the german link with /en prepended instead of actually using the translated version.
Happens with posts, terms, products, etc.
Example from product_cat:
/en/category/engine/engine-control/ in default/german sitemap
/en/kategorie/lenkung/lenkradnabe/ in english sitemap although the correct link is /en/category/steering/steering-hub/Thanks
Philipp
-
Hello,
Thank you for reaching out to us regarding the sitemap issues you are facing with Rank Math and WPML.
Based on the information provided, it seems like you are experiencing incorrect entries in your sitemap for translated pages, including product categories. This issue can lead to 404 errors and impact your rankings negatively.
The problem you described is a common issue faced by users when incorrect entries are added for translated pages in the sitemap. This can happen due to various reasons, including how translations are handled by WPML and Rank Math.
To address this issue, you can add a piece of code to your theme’s functions.php file. Here is the code snippet you can use:
add_filter('rank_math/sitemap/entry', function ($url){ if (isset($url['loc']) && empty($url['loc'])) { return false; } return $url; });
By adding this code, you can help prevent incorrect entries from appearing in your sitemap, ensuring that the correct URLs are included for your translated product categories.
If you need further assistance or have any other questions, please feel free to let us know. We’re here to help!
Best regards.
Sources:
Multilingual SEO with Rank Math SEO & WPML » Rank Math
Rank Math Sitemap Issues and Their Fixes » Rank Math
Remove Blank Lines From Sitemaps » Rank Math
Why Are My Translated Pages Not in the Sitemap? » Rank MathHello,
Thank you for contacting us and sorry for any inconvenience that this issue might have caused.
To attempt to resolve this issue, consider installing the WPML SEO glue extension:
https://wpml.org/compatibility/2021/04/wpml-seo-plugin-better-integration-with-seo-plugins/This extension is designed to enhance compatibility and may assist in resolving the issue with the sitemap.
Once installed and activated can you please flush the sitemap cache by following the steps below to see if that works for you?
#1. Flush the Sitemap cache by following this video screencast:
https://i.rankmath.com/pipRDp#2. Exclude the Sitemap files of the Rank Math plugin in your caching plugin. The cache could be via a plugin or from the server.
For plugins, please follow this article ( if you use caching plugins ) :
https://rankmath.com/kb/exclude-sitemaps-from-caching/For Cloudflare, please follow this article ( if you use cloudflare ) :
https://rankmath.com/kb/exclude-sitemaps-from-caching/#cloudflare#3. If the above steps doesn’t seem to work, kindly apply the following filter code to your site.
add_filter( 'rank_math/sitemap/enable_caching', '__return_false');
Here’s how you can add filter/hook to your WordPress site:
https://rankmath.com/kb/wordpress-hooks-actions-filters/If installing the WPML SEO glue extension and flushing the sitemap cache doesn’t resolve the issue do let us know.
We hope that helps, and please don’t hesitate to get in touch if you have any other questions.
Thank you.
Hello Ike, thanks for getting back to me.
The plugin was activated, now the english sitemap is gone alltogether!?
The german one was updated, but still has incorrect entries.Please let me know how to solve the old and new problems.
Philipp
Hello,
We might need to take a closer look at the settings. Please edit the first post on this ticket and include your WordPress & FTP logins in the designated Sensitive Data section.
Please do take a complete backup of your website before sharing the information with us.
It is completely secure and only our support staff has access to that section. If you want, you can use the below plugin to generate a temporary login URL to your website and share that with us instead:
https://wordpress.org/plugins/temporary-login-without-password/
You can use the above plugin in conjunction with the WP Security Audit Log to monitor what changes our staff might make on your website (if any):
https://wordpress.org/plugins/wp-security-audit-log/
We really look forward to helping you.
Hello Jeremy, please let me know which settings you need and I will post them asap. I am not keen on sharing credentials, sorry.
Thanks
PhilippHello,
We requested access to your website to fully debug this issue further as we are unable to reproduce this issue on our end here.
There must be a reason the issue is happening on your website, and that is what we need to discover so that we can offer the right solution.
In this case, since you aren’t able to share your website admin for us to troubleshoot further, are you able to create a staging website on your end?
If you can, please create one, and share the login access here, this will allow us to deeply investigate the issue and resolve it permanently without worrying about touching your live website.
You can follow this article to create the staging website: https://www.wpbeginner.com/wp-tutorials/how-to-create-staging-environment-for-a-wordpress-site/
We look forward to hearing back from you.
Thank you.
Hello,
I have updated the sensitive data as requested. Can you please check further?
Thank you.
Hello,
When we enabled the WPML SEO plugin, the
en/sitemap
doesn’t work because our plugin only generates the default sitemap. WPML takes care of the rest. When a search engine bot visits any post/page, it is shown hreflang tag that helps it crawl the translated pages. This is one of the recommended methods by Google. https://support.google.com/webmasters/answer/189077?hl=enYou should enable the WPML SEO plugin on the live site and only submit the main sitemap_index.xml to your GSC account as it has the correct URLs of both languages.
Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.
Hello Jaideep, as I mentioned before the sitemap still has wrong entries when the SEO helper plugin is activated.
Please refer to my earlier messages.
Thanks
PhilippHello,
Right now, we don’t see any wrong entries leading to a 404.
Can you please share with us another set of invalid entries that are currently listed in your sitemap while the WPML SEO plugin is enabled?
Looking forward to helping you.
Hello Jeremy,
valid entries are still missing. For example products exist, but are not in the sitemap. (e.g. /en/product/maxilite-alloy-wheel-barock-7×15-et23-silber-tuev-mercedes-r107-w108-w109-w113-w114-w115-w116-w123-w124-w126/)
Found out about in current ahrefs report and verified manually.
Current production database has been imported to staging for further troubleshooting.
Thanks
PhilippHello,
The Product link you shared does not exist and is returning a 404 error. Here’s a screenshot:
(image removed as requested by user)
Please double-check this and let us know.
Hello,
I have updated the sensitive data as requested. Can you please check further?
Thank you.
Hello, it does exist. I posted the link.
Please remove the screenshot.
Thanks
PhilippHello,
The previous link you shared is slightly different from the one in the sensitive data section – which is why it was showing 404 and is probably the reason you didn’t find it in your product sitemap. Here’s a short video: (moved to the sensitive data section)
The correct product link you shared in the sensitive data section is in your product sitemap, specifically
/product-sitemap2.xml
. Here’s a screenshot: (moved to the sensitive data section)We hope this helps clarify the issue. Please let us know if you have any other questions or concerns.
Hello,
Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.
If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.
Thank you.
The ticket ‘Sitemap Issues w. Product Categories’ is closed to new replies.