Yoast / wordpress-seo

Yoast SEO for WordPress
https://yoast.com/wordpress/plugins/seo/
Other
1.75k stars 885 forks source link

Sitemap Error: XML or text declaration not at start of entity #11181

Closed PrashGupta closed 5 years ago

PrashGupta commented 5 years ago

Please give us a description of what happened.

My sitemap xml reported an error saying "error on line 2 at column 6: XML declaration allowed only at the start of the document".

I went thru the troubleshooting steps as given by Yoast here: https://kb.yoast.com/kb/xml-sitemap-error/

Installed the "Health check" plugin as suggested & started the troubleshooting mode. The first plugin that I enabled was Yoast & could immediately see that the problem was reproduced. Which means that the issue is caused by the Yoast Plugin

Please describe what you expected to happen and why.

I expected the sitemap to be generated as it was happening before..

How can we reproduce this behavior?

These were the steps I followed

  1. Installed Health Check Plugin & enabled it
  2. Started the Troubleshooting mode
  3. Enabled the Yoast plugin and the problem was reproduced

Technical info

benvaassen commented 5 years ago

Thanks for reporting. I can't reproduce the issue though, so it's probably not an issue we can fix for you in our codebase.

Did you also clear all caching after activating Yoast SEO with the Health Check plugin? What does the source code look like of your sitemap? Even better, can you provide me with a link to the sitemap?

PrashGupta commented 5 years ago

Hi @benvaassen , Yes I did clear the cache before activating Yoast SEO with the Health Check plugin. It gives that error.

The link to sitemap is https://www.lavendertheboutique.com/sitemap_index.xml Hope this helps

CarolineGeven commented 5 years ago

@PrashGupta Thanks for letting us know. Is there a chance you've edited your functions.php for example? The cause most often is an empty line at the beginning (before the <?php line) or end of the wp-config.php or functions.php file. Did you check these files?

PrashGupta commented 5 years ago

Hi @CarolineGeven No, I haven't edited any of those files - manually they are completely untouched in this installation. I can separately share with you these files in private if needed, as I would not like those in the public forum. Let me know

CarolineGeven commented 5 years ago

@PrashGupta Thank you. Could you please update to the latest version of Yoast SEO if you haven't done so?

Did you also check with all plugins off and just Yoast SEO on? This issue is not caused by Yoast SEO and must be caused by a third party plugin.

Fortunately the error you are receiving, is not harming the indexing of your sitemap. When you visit the source of your website (right click: view source), you will see that the XML is parsed correctly. This means Google will still be able to read the sitemap. I understand you wish to solve this issue however, so our advise would be to turn off all plugins, clear your cache and check if the issue is solved, then reactivate each plugin one by one to see what causes the issue.

PrashGupta commented 5 years ago

Hi @CarolineGeven Yes, I am updated to the latest version of Yoast SEO

Regarding checking the plugins, I have used the Health Check Plugin to troubleshoot - as described in the issue report above & based on that, it is the Yoast SEO plugin that seems to be causing the issue

Yes, I wish to solve the issue & would hence seek your help for that.

PrashGupta commented 5 years ago

This seems to have been another plugin issue (not Yoast) - probably got resolved with an update. I could never figure out who was causing it. But the problem is resolved, hence closing the issue Thanks for your support