I’m checking the sitemap of my site and when I click to generate I get this error
This page contains the following errors:
error on line 2 at column 6: XML declaration allowed only at the start of the document
Below is a rendering of the page up to the first error.
How can I solve?
Thank you for contacting Rank Math and sorry for any inconvenience that might have been caused due to that.
That is usually due to an extra whitespace at the end or beginning of the functions.php file on your theme. You can check it and try to remove it, but if you don’t find it, let us know and we will be happy to take a look for you.
Looking forward to helping you. Thank you.
Hi, I can’t fix it.
I have checked an extra whitespace at the end or beginning of the functions.php file of the Parent Theme and the Child Theme.
I have also checked the rank-math.php file of the Rank Math plugin, and if I add spaces at the beginning of the file, the error message changes the line number, instead of indicates:
“error on line 2 at column 6: XML declaration allowed only at the start of the document”
“error on line 3 at column 6: XML declaration allowed only at the start of the document”
or another line number depending on how much space you have left for the file.
But the problem remains the same and I cannot see the sitemap.
I think that the problem is the plugin Rank Math, some mistake.
I leave a username and password in the sensitive data section so that you can enter to solve it.
Thank you so much !
I tried to access your URL wp-admin but I am getting restricted access, probably by your security plugin.
To find find the issue you have to find first the cause. You can do this by doing the following:
1. Install and activate a default theme on the site. Clear your cache, resave your permalinks settings and check if the issue disappears from your sitemap.
2. If the issue is not with your theme, you can reactivate your theme then go to plugins page. Deactivate the plugins one by one, while still checking your sitemap until you find the cause of the issue.
If not the issue is not with either your theme or plugins, then it is likely coming from your wp configuration file(s)
You can also try this guide here: https://wejn.org/stuff/wejnswpwhitespacefix.php.html to fix all whitesapces on your files.
Hope that helps. If you have any further question(s), please let us know. Thank you.
I don’t understand why you can access, I’ve tried it and it’s fine, but doesn’t matter, I think the problem is solved.
I installed and activated a default theme, I cleared the cache and resaved the permalinks, and I clicked to generated the sitemap and it works.
Later, I enabled original theme and the sitemap it’s fine.
At the moment seems that the problem is solved, I’ll try it in a few days and if it works, the problem is solved.
Thanks for all.
Those are good news! Then, do you have any other questions? Or do you want us to close this thread? In any case, we will be here if you have any other questions or issues in the future.
Looking forward to help you.
https://www.allinoneweb.in/sitemap_index.xml facing error in my linne 2 and column 6 as shown by rank match . Kindly help
https://www.allinoneweb.in/sitemap_index.xml facing error in my linne 2 and column 6 as shown by rank match . Kindly help pls
I don’t understand the last 2 replys. It’s spam I supose.
On other hand, the same problem appears on my site when I try to see my sitemap. Error linne 2 and column 6, I’ll try the same solution that the last time but if every time I’ve to do this:
“I installed and activated a default theme, I cleared the cache and resaved the permalinks, and I clicked to generated the sitemap and it works.”
I think that is not a good solution, because is not defenitive.
That issue is due to a white space, probably in your functions.php file. That is why when changing the theme it works, but as you say, it is just a temporal fix.
If you want, we can log in and try to fix it for you. To do that, please edit the first post on this ticket and include your WP logins in the designated Sensitive Data section.
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:
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):
We really look forward to helping you.
You must be logged in to reply to this ticket.