Hello,
We apologize for the issue you are facing with your sitemap_index.xml
. The error message you are seeing, "XML declaration allowed only at the start of the document," typically indicates that there are some 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 White Spaces: Ensure that there are no blank lines or spaces before the ` declaration in your sitemap file. This could be caused by a blank line in your
wp-config.phpfile or your theme's
functions.php` file.
-
Plugin Conflicts: If there are no white spaces, check for any plugin conflicts using the Health Check plugin.
-
Clear Cache: Make sure to clear any caching plugins you might be using, as they could be serving an outdated version of your sitemap.
-
Flush Permalinks: Go to your WordPress admin area, navigate to Settings → Permalinks, and click the “Save Changes” button. This can help refresh your permalinks and potentially resolve the issue.
If these steps do not resolve the problem, please reply to this ticket, and a human agent from the Rank Math Support team will assist you further. Thank you for bringing this to our attention!
Sources:
Rank Math Sitemap Issues and Their Fixes » Rank Math
Hello,
Thank you for contacting us. We apologize for any inconvenience this issue may have caused.
This sitemap error indicates that there must be some white space before the XML Sitemap’s source code. You can also look at the source code of your Sitemap and see if there is an extra line before the XML.
This is usually caused by a blank line or space in your wp-config.php
or functions.php file
.
It is also very much possible that your sitemap’s xml tag is missing which might be creating a blank line.
Please follow this troubleshooting guide to fix that issue:
https://rankmath.com/kb/fix-sitemap-issues/#xml-text-declaration
We hope this helps. Please let us know if you have further questions or concerns.
Thank you.