• Resolved webdesinz

    (@webdesinz)


    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/ and 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
    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 to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Support Jerlyn

    (@jerparx)

    Hi @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.

    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 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

    (@stodorovic)

    Hi @webdesinz,

    You could read more about similar issues:

    https://github.com/Yoast/wordpress-seo/issues/8394
    https://github.com/Yoast/wordpress-seo/issues/7140
    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)

    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. Try to re-save file without BOM (eg. you can use Notepad++ – Cannot modify header information – headers already sent by).

    If you are still experiencing issue after switching to twenty seventeen (and deactivating all plugins except Yoast SEO), please check following:

    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

    (@webdesinz)

    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

    (@stodorovic)

    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?

    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).

    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

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    @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://www.ads-software.com/support/guidelines/#being-mod-watched-or-banned

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    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://www.ads-software.com/support/guidelines/#avoid-signatures

    Thread Starter webdesinz

    (@webdesinz)

    @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

    (@webdesinz)

    I should also mention if anyone else has a problem like this, that @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 who is super knowledgeable and a quick troubleshooter. Congratulations to support, you are fantastic.

    • This reply was modified 6 years ago by 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.