XML Parsing Error: XML or text declaration not at start of entity in wordpress

I face a error problem, i used WordPress SEO plugin, when i enable xml site map and visit my sitemaps list http://localhost/sitemap_index.xml then show this error
see screenshot http://prntscr.com/8ffuph

I have already tried lot of tips in WordPress directory and stackoverflow
but I’m not successfully, because I’m beginner level in PHP. please help me.

Related posts

4 comments

  1. Check your themes functions.php file and other plugins for trailing whitespace (or opening whitespace) outside of the 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.

  2. if it’s happened on WordPress, you need to edit your functions file and remove whitespace (or opening whitespace) outside of the tags at the start and end and save the file
    problem resolved 😎👍

  3. Instead of examining and fixing all your plugins manually, which can be cumbersome if you have a lot of them installed, you can try if this plugin does the trick:

    https://github.com/xemlock/wordpress-seo-sitemap-fix

    I wrote it a while ago for this exact purpose – to overcome this tiny, but annoying, implementation flaw of the WordPress SEO plugin.

  4. I had this problem as well when I wanted to use the SEO plugin sitemap.
    It is more commonly happens in functions.php:

    1. Go to your active theme functions.php.
    2. in the end, delete ?>
    3. backspace till you reach the code.

Comments are closed.