Hello,
We apologize for the issue you are facing with generating your Sitemap. The error message you are encountering, "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:
- Inspect your
wp-config.php file and your theme’s functions.php file for any blank lines or spaces before the opening `
I appreciate how tech helps us avoid surprises by showing menu prices clearly before we order!
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. This can make your sitemap invalid and unreadable by search engines.
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,
We are super happy that this resolved your issue. If you have any other questions in the future, know that we are here to help you.
If you don’t mind me asking, could you please leave us a review (if you haven’t already) on https://wordpress.org/support/plugin/seo-by-rank-math/reviews/#new-post about your overall experience with Rank Math? We appreciate your time and patience.
If you do have another question in the future, please feel free to create a new forum topic, and it will be our pleasure to assist you again.
Thank you.