Hello,
We apologize for the issue you are facing with your sitemap. The error message you are seeing, "XML declaration allowed only at the start of the document," typically indicates that there are unwanted spaces or blank lines before the XML declaration in your sitemap file.
Here are a few steps you can take to resolve this issue:
-
Check for Blank Spaces: Ensure that there are no blank lines or spaces before the ` line in your sitemap file. This can often happen if there is an extra line in your
wp-config.phpfile or your theme’s
functions.php` file.
-
Plugin Conflict: If you do not find any blank spaces, it might be due to a plugin conflict. You can use the Health Check plugin to identify any conflicting plugins.
-
Clear Cache: Make sure to clear any caching on your website, as cached versions of your sitemap may also cause this issue.
If you continue to experience problems, please reply to this ticket and include your website URL so we can assist you further. Thank you for raising this concern!
Sources:
Rank Math Sitemap Issues and Their Fixes » Rank Math
The Problem continue.
My Site is: https://pestalia.it/
Do you need other information?
Hello,
Thank you for contacting Rank Math support, and sorry for the inconvenience this may have caused.
The issue you are seeing is caused by an XML declaration error on your sitemap. This means that there is some extra content or whitespace before the XML declaration in your sitemap file.
The most common reason for this error is a whitespace in your theme code, such as a blank line or space in your wp-config.php
file or your theme’s functions.php
file. This can happen when you edit these files manually or use a plugin or theme that modifies them.
To fix this error, you need to find and remove the whitespace from your theme code. You can follow this guide to troubleshoot and resolve this issue: https://rankmath.com/kb/fix-sitemap-issues/#xml-text-declaration
If the issue persists, you can also use this script to automatically fix this error: https://wejn.org/stuff/wejnswpwhitespacefix.php.html
Looking forward to helping you
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.