Just revamped. Got feedback? Share now.
Is your sitemap or other XML file in Wordpress throwing XML declaration error? It's not WP error. Something happened on our files end. Lets get into that.
You may have encountered an error like below:
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.
We encountered this error on WP Sitemap /wp-sitemap.xml
and SEO Yoast Sitemap XML /sitemap_index.xml
URLs. However, in you case it could be other website with or without WP or Yoast.
This XML declaration error appears for any of the following reasons: –
Though this issue is most common issue, however, this is sometimes frustrating to fix. Since it is hard to track which file could be having an empty line at the end of file, it becomes a time taking activity.
The helping news is: you can still fix this with divide and conquer rule.
Start with most common files where you or your team edit code. These are functions.php
in child or parent theme, wp-config.php
in the WP root directory, and template files (if you have) in child theme.
If you don’t make changes to wp-config.php
or functions.php
or other template files often, then head towards ‘recently’ installed plugins. Disable them one by one and check if the XML declaration error goes away.
Common plugins that may produce this error are: –
If you just installed so many plugins or it was your new WP installation with tons of plugins and themes, we recommend using
Related similar errors which the above solution may fix:
Our standardized editorial process ensures right, timely, and healthy updates to our content. Your honest opinion drives significant improvement to our content. We appreciate you are taking time to share that.
100K+ readers have already joined the lists of their choice. Will you? Just now, maybe?
Pick List(s) to Subscribe