Sitemap error: error on line 2 at column 6: XML declaration allowed only …

sitemap error WordPress

Today I faced with the problem of my sitemap.xml file appearance in WordPress blog. When I typed itfaq.info/sitemap.xml there was the following error (the error screen you can see in featured image to this post ):

This page contains the following errors:
error on line 2 at column 6: XML declaration allowed only at the start of the document
Below is a rendering of the page up to the first error.

How to fix error on line 2 at column 6: XML declaration allowed only at the start of the document WordPress?

First of all I want to explain you what this error means: it says that there is a problem with the work of your blog RSS feed. This error is usually happened if you have extra empty lines or spaces in functions.php file. For example, you have added some additional code to the end of
functions.php that had invisible spaces or lines.

So find in left panel ‘Appearance’, move to ‘Theme Editor’ and find in right panel ‘functions.php’. If you file ends with ‘?>’ check that there are no spaces after it, if it is – remove them. N.B. Don’t forget to create backup of the file that you are going to change. If something is going wrong you can restore the previous one.

If it does not help you and the error on line 2 at column 6 still present, install plugin Fix My Feed RSS Repair, it checks and removes empty lines in whole theme. When the problem is solved deactivate/remove the plugin.

IMPORTANT: If you installed plugin for cache, don’t forget to deactivate them or erase cached data, as the error (XML declaration allowed only at the start of the document) can visually remain though you solved it.

Check all from above and surely you problem with
This page contains the following errors:
error on line 2 at column 6:
‘ will be resolved, if no please write your problem in comment and let’s try to find the issue for you!

Good luck! 😉

Rate article
Add a comment

  1. Nishant

    Dude! Thanks for this. I was searching for a solution and everybody was telling that remove space from functions.php or wp-config.php, there was no space there at all. After installing and using the above-mentioned plugin, the error was gone from my blog (www.nishant.blog). Thanks

    Reply
    1. Liza author

      Great that it helped you! Good luck! 🙂

      Reply
  2. Abimbola

    Wow, great it work. 100%

    Reply
  3. Isaac Kashiya

    Je vous suis vraiment reconnaissant. Que Dieu vous bénisse!

    Reply
  4. Tharindu

    I use for fix this issue Fix My Feed RSS Repair plugin

    Reply
  5. Valérie RdeJ

    Wahou, génial, je cherchais une solution pour ce problème depuis des semaines sans résultat … Merci beaucoup ! 🙂

    Reply
  6. Srinath

    Thanks. I am glad I found this article.

    Reply
  7. Osaro

    Am so glad I found this. This is the best explanation. Tried YouTube and all other website …this plugin is the best solution I will donate to the plugin

    Reply
  8. Bittor Gonzalez

    I am very grateful for the help, it has solved a problem that I had been trying to fix for days. Greetings from Spain and thank you.

    Reply
  9. Ayhan

    Fix My Feed RSS Repair plugin solve the problem. Many thanks

    Reply
  10. Ask Sawal

    I have been looking for this Sitemaps article since long time. Thanks author.

    Reply
  11. Larry

    My issue is resolved Thank you for sharing summarize information.

    Reply