Title: Cannot create Yoast sitemap due to parsing error
Last modified: November 2, 2018

---

# Cannot create Yoast sitemap due to parsing error

 *  Resolved [webdesinz](https://wordpress.org/support/users/webdesinz/)
 * (@webdesinz)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/cannot-create-yoast-sitemap-due-to-parsing-error/)
 * I posted this on github a month ago and got no replies. Cannot create sitemap.
   Cannot get my website listed with search engines, without a sitemap, although
   I can be found on google, but ranking is poor. I most definitely have my sitemap
   switched on in my wp-admin dashboard, under yoast / features. have added health
   check and ran troubleshooting as per [https://kb.yoast.com/kb/xml-sitemap-errors/](https://kb.yoast.com/kb/xml-sitemap-errors/)
   and [https://kb.yoast.com/kb/how-to-check-for-plugin-conflicts/](https://kb.yoast.com/kb/how-to-check-for-plugin-conflicts/)
 * but I could not find the conflict and tried another theme and sitemap plugin,
   disabled all plugins but yoast; reset my permalinks, but no matter what I did–
   when I tried to view the sitemap_index.xml, I got the following message:
    XML
   Parsing Error: XML or text declaration not at start of entity Location: [https://eco-health.co.nz/sitemap_index.xml](https://eco-health.co.nz/sitemap_index.xml)
   Line Number 4, Column 1: ^
 * One solution was stated:
    There are probably several lines of whitespace preceding
   the <?xmltag What should I do, as I need more detailed instruction than what 
   was given by yoast about how to fix this, for which file to edit and exactly 
   what error to remove. And it may not be that at all…. Any suggestions?Thanks,
   Gill
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fcannot-create-yoast-sitemap-due-to-parsing-error%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 8 replies - 1 through 8 (of 8 total)

 *  [Jerlyn](https://wordpress.org/support/users/jerparx/)
 * (@jerparx)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/cannot-create-yoast-sitemap-due-to-parsing-error/#post-10842497)
 * Hi [@webdesinz](https://wordpress.org/support/users/webdesinz/),
 * The error you are getting on your sitemap typically happens when a plugin or 
   theme function incorrectly adds an empty whitespace at the beginning of the sitemap.
   The Yoast SEO plugin does not cause this issue.
 * When we checked your sitemap, there’s indeed a white space at the very top of
   the page as shown in [this screenshot](https://imgur.com/a/k0iipgo).
 * The cause most often is an empty line at the end of the functions.php file. If
   there is no empty line in this file, we highly recommend running a [conflict check](https://kb.yoast.com/kb/how-to-check-for-plugin-conflicts/)
   to identify what outputs the empty white space. We recommend switching your theme
   to the default WP default theme like Twenty Seventeen and then disable all other
   plugins.
 * You may also need to clear your cache from your plugins/theme/CDN such as Cloudflare/
   server caching etc. If you are not sure how to clear caching please speak with
   your developers or contact your host provider.
 * Once you have identified whether your theme or a plugin causes the issue, please
   contact the developers of the theme or plugin for assistance finding and removing
   the whitespace.
 *  [Saša](https://wordpress.org/support/users/stodorovic/)
 * (@stodorovic)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/cannot-create-yoast-sitemap-due-to-parsing-error/#post-10843781)
 * Hi [@webdesinz](https://wordpress.org/support/users/webdesinz/),
 * You could read more about similar issues:
 * [https://github.com/Yoast/wordpress-seo/issues/8394](https://github.com/Yoast/wordpress-seo/issues/8394)
   
   [https://github.com/Yoast/wordpress-seo/issues/7140](https://github.com/Yoast/wordpress-seo/issues/7140)
   [https://github.com/Yoast/wordpress-seo/issues/7105](https://github.com/Yoast/wordpress-seo/issues/7105)…
 * I’ve already written following instructions:
 * > Every page on your page (included sitemaps) contains empty line at the begin.(
   > You can see HTML source) You should remove this line to fix sitemaps. You can
   > try following steps:
    - Check your `wp-config.php` file for blank lines outside of _<?_ and _?>_ bracketed
      sections.
    - Check your theme’s `functions.php` file for blank lines outside of _<?_ and_?
      >_ bracketed sections.
    - One by one, disable plugins and re-validate until you isolate the one causing
      the problem ([How To Check For Plugin Conflicts](https://kb.yoast.com/kb/how-to-check-for-plugin-conflicts/))
 * Note that the final php `?>` should be omitted from all PHP code files – modules,
   includes, etc. (eg. `wp-config.php`, `functions.php`, …).
 * More instructions (related to first and second step) you can find on [How_do_I_solve_the_Headers_already_sent_warning_problem](https://codex.wordpress.org/FAQ_Troubleshooting#How_do_I_solve_the_Headers_already_sent_warning_problem.3F).
   Try to re-save file without BOM (eg. you can use Notepad++ – [Cannot modify header information – headers already sent by](https://wordpress.stackexchange.com/questions/74141/error-cannot-modify-header-information-headers-already-sent-by/120744#120744)).
 * >  If you are still experiencing issue after switching to twenty seventeen (and
   > deactivating all plugins except Yoast SEO), please check following:
    - Auto prepend PHP file ( [http://php.net/manual/en/ini.core.php#ini.auto-prepend-file](http://php.net/manual/en/ini.core.php#ini.auto-prepend-file))
      or something similar related to PHP configuration
    - Check WP core files ( instructions for update/reinstall – [https://codex.wordpress.org/Upgrading_WordPress_-_Extended_Instructions](https://codex.wordpress.org/Upgrading_WordPress_-_Extended_Instructions))
    - Manually update of Yoast SEO plugin ( [https://kb.yoast.com/kb/how-can-i-update-my-free-plugin/#ftp](https://kb.yoast.com/kb/how-can-i-update-my-free-plugin/#ftp))
 * If you still can’t find where are empty lines then you could go to my gists on
   github and download `whitespace-test.php` (I just shared it on github). Upload
   this php file into directory where wp is installed and open in browser home_url/
   whitespace-test.php (home_url is full URL for your website). It should “simulate”
   ajax request (because it should prevent starting of output buffers), load wp 
   bootstrap, send header and try to detect first output… It’s big change to locate
   file where is empty line. If it’s WP core file please reinstall WP files.
 * I hope that are detailed instruction which you need,
    Saša
 *  Thread Starter [webdesinz](https://wordpress.org/support/users/webdesinz/)
 * (@webdesinz)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/cannot-create-yoast-sitemap-due-to-parsing-error/#post-10845456)
 * Thank you both for your very extensive help options.
    I did remove the space 
   and cleared caches and I already switched themes and tested plugins one by one.
   I think I will have to close the website down and install another wordpress, 
   and perhaps import the posts, and use another theme, as long as I dont import
   the error again? If anything next is to be done, it will be Saša’s advanced advice
   steps. However this is beyond me how to fix this problem. So I have written to
   the theme authors to ask for help, but I know my support window is now closed
   as its more than 6 months expired. Can’t afford to pay to renew support fee, 
   nor a developer to fix as its my own hobby blog site, and its cheaper for me 
   to start again.
 *  [Saša](https://wordpress.org/support/users/stodorovic/)
 * (@stodorovic)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/cannot-create-yoast-sitemap-due-to-parsing-error/#post-10845826)
 * I’m trying to find out more details about your issue. I don’t know which is your
   knowledge but if you can access your website using File manager or via FTP then
   I think that I can help you. It’s big chance that _wp-config.php_ contains empty
   line or lines. Could you access to this file – [Where is my WordPress configuration file](https://www.siteground.com/kb/wordpress_configuration_filewpconfigphp/)?
 * I’ve tried to check more details related to theme, but I don’t think that issue
   is in the theme (maybe child theme, but you have tested other theme). I think
   that we could exclude plugins too. Maybe there are issues in WP core files if
   your website was infected (and cleaned), but WP updates have probably overwritten
   WP files in meantime. It’s reason why I think that _wp-config.php_ could be issue
   which could be detected if you upload and run PHP script _whitespace-test.php_(
   which I recommend in my previous post). Also please check all comments (text 
   between _/*_ and _*/_) in _wp-config.php_ because there could be hidden something
   like this `?>...<?php`. Default _wp-config.php_ should contain only `<?php` at
   the begin (without `?>` at the end). Also, please try to save _wp-config.php_
   without BOM at the begin (Notepad++ has this option – [https://wordpress.stackexchange.com/questions/74141/error-cannot-modify-header-information-headers-already-sent-by/120744](https://wordpress.stackexchange.com/questions/74141/error-cannot-modify-header-information-headers-already-sent-by/120744)).
 * Do you have installed cache plugin? WPSC has filter which can “modify” output
   buffers and it could to help to we identify moment when empty lines send.
 * _[ redacted ]_
    Regards, Saša
    -  This reply was modified 7 years, 5 months ago by [Jan Dembowski](https://wordpress.org/support/users/jdembowski/).
 *  Moderator [Jan Dembowski](https://wordpress.org/support/users/jdembowski/)
 * (@jdembowski)
 * Forum Moderator and Brute Squad
 * [7 years, 5 months ago](https://wordpress.org/support/topic/cannot-create-yoast-sitemap-due-to-parsing-error/#post-10846430)
 * [@stodorovic](https://wordpress.org/support/users/stodorovic/) I have redacted
   your offer to contact the user away from these forums. Please do not do that,
   that is not how these forums work and you can get banned for that here.
 * As it is I have flagged your account for moderation.
 * [https://wordpress.org/support/guidelines/#being-mod-watched-or-banned](https://wordpress.org/support/guidelines/#being-mod-watched-or-banned)
 *  Moderator [Jan Dembowski](https://wordpress.org/support/users/jdembowski/)
 * (@jdembowski)
 * Forum Moderator and Brute Squad
 * [7 years, 5 months ago](https://wordpress.org/support/topic/cannot-create-yoast-sitemap-due-to-parsing-error/#post-10846432)
 * Also thanks for the great support but please lose the signature. That’s prohibited
   in these forums as it’s been horribly abused in the past by others.
 * > Regards,
   >  Saša
 * Yes, bad people ruin it for others and no, I’m not kidding. Please refrain from
   that.
 * [https://wordpress.org/support/guidelines/#avoid-signatures](https://wordpress.org/support/guidelines/#avoid-signatures)
 *  Thread Starter [webdesinz](https://wordpress.org/support/users/webdesinz/)
 * (@webdesinz)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/cannot-create-yoast-sitemap-due-to-parsing-error/#post-10848534)
 * [@stodorovic](https://wordpress.org/support/users/stodorovic/) has solved the
   issue! It was a plugin conflict. Well done! He spotted I had a faulty JC Recaptcha
   plugin that had poor standard code. So I deactivated the plugin and purged cache.
   
   Many thnx for your excellent support.
 *  Thread Starter [webdesinz](https://wordpress.org/support/users/webdesinz/)
 * (@webdesinz)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/cannot-create-yoast-sitemap-due-to-parsing-error/#post-10850825)
 * I should also mention if anyone else has a problem like this, that [@stodorovic](https://wordpress.org/support/users/stodorovic/)
   located and removed empty lines from jc_recaptcha.php, the offending plugin. 
   So even without deactivating the plugin, it allowed my sitemap to fully work 
   again. Somebody should tell the authors of JC Recaptcha that they left empty 
   lines which is sloppy.
 * Thanks again to [@stodorovic](https://wordpress.org/support/users/stodorovic/)
   who is super knowledgeable and a quick troubleshooter. Congratulations to support,
   you are fantastic.
    -  This reply was modified 7 years, 5 months ago by [webdesinz](https://wordpress.org/support/users/webdesinz/).

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Cannot create Yoast sitemap due to parsing error’ is closed to new replies.

 * ![](https://ps.w.org/wordpress-seo/assets/icon-256x256.gif?rev=3419908)
 * [Yoast SEO - Advanced SEO with real-time guidance and built-in AI](https://wordpress.org/plugins/wordpress-seo/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wordpress-seo/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wordpress-seo/)
 * [Active Topics](https://wordpress.org/support/plugin/wordpress-seo/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wordpress-seo/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wordpress-seo/reviews/)

 * 8 replies
 * 4 participants
 * Last reply from: [webdesinz](https://wordpress.org/support/users/webdesinz/)
 * Last activity: [7 years, 5 months ago](https://wordpress.org/support/topic/cannot-create-yoast-sitemap-due-to-parsing-error/#post-10850825)
 * Status: resolved