Support » Plugin: Yoast SEO » Sitemap error: XML declaration allowed only at the start of the document

Viewing 6 replies - 1 through 6 (of 6 total)
  • Jon Cave


    WordPress Dev

    Check your themes functions.php file and other plugins for trailing whitespace (or opening whitespace) outside of the <?php and ?> tags. I think something is outputting whitespace before the SEO plugin has a chance to display the sitemap and that is the most likely cause.

    This took me ages to fix, but think its working now on this site:

    Thanks Jon – you are bang on with the cause – bit of custom taxonomy work resulted in white space at the bottom of functions file. Disabling plugins made no difference, try cleaning up you functions.php file first folks!

    Plugin Author Joost de Valk


    Yeah that’s always a tricky one, I’m trying to see if there’s a better solution but all the ones I’ve found so far are hackish 🙂 Closing this thread.

    Thanks for an awesome plugin though Joost.

    Maybe if poss, mention whitespace in functions.php in the error message? Could you even put a small function in that then attempts to remove possible offending white space?!


    Plugin Author Joost de Valk


    The error message isn’t generated by the plugin but by the browser…

    I also got this problem in the RSS feed. But I didn’t realize it, first the problem was that the wp-admin page shows a blank page. I have been 2 days trying to fix it and I realize that the problem was some blank space lines in the code in functions.php. Search for any blank line spaces between <?php and ?> and erase them. That should fix the RSS and other problems.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Sitemap error: XML declaration allowed only at the start of the document’ is closed to new replies.