• About us
  • Blog
  • Contact
WordPress Themes – PressWorkWordPress Themes – PressWork
  • FREE THEMES FOR WORDPRESS
  • Order website creation
  • FAQ`s
  • FREE THEMES FOR WORDPRESS
  • Order website creation
  • FAQ`s
  • About us
  • Blog
  • Contact
Alex Sky2016-06-13T19:58:51-05:00
Fix WordPress error, sitemap.xml

Back in 2010, a problem had arisen where WordPress would cause an error to appear in the browser whenever loading the RSS feed.

This problem simply prevented the WordPress RSS feed from working. The RSS feed was quite important to many website owners back then and it is probably still important to many even today.

As of lately, a similar error has been popping up on the sitemap.xml of WordPress websites. On a browser like Chrome, the error that you might get in your sitemap.xml while working on your WordPress website reads something like:

“This page contains the following errors: error on line 3 at column 6: XML declaration allowed only at the start of the document”

WordPress error

The sitemap will get messed up if this error appears, as a result of which an invalid XML will be produced. If you are generating the sitemap using a plugin, it may seem like the issue is a result of the plugin, but that is actually not the case. You might assume that changing your website’s theme and/or disabling plugins will resolve the issue, but that will not be necessary, so it is not worth wasting your time on that.

How To Remove WordPress “error on line 3 at column 6” From sitemap.xml?

Step #1: To get rid of this error, you will require a small PHP file/script by the name of “spacefix.php” that you can download.

Step #2: Once you have downloaded the above .php file, it will have to be uploaded into the Theme’s folder of your WordPress website. If you are not sure which is the Theme’s folder, it is basically the directory that contains a functions.php file. Make sure that you avoid uploading the mentioned downloaded .php file into the plugins or root folder; it needs to be placed in the Theme’s folder.

Step #3: Once you have uploaded the PHP file into the Theme’s folder, you will have to edit the functions.php file. You will have to add “include(“spacefix.php”);” right after the first line “<?php” in the functions.php file.

In other words, it should look like the following:

<?php
include("spacefix.php");

Make sure you do not tinker with anything else in the functions.php file unless you know what you are doing. Make sure that you uploaded the spacefix.php into the same folder where the functions.php is present, which is supposed to be the Theme’s folder. If you end up uploading the spacefix.php in some other folder, then you will have to change the file’s path, which will only be a waste of effort and time.

Conclusion

Make sure you save the functions.php after doing all of the above, after which you can refresh the sitemap.xml. The sitemap.xml will now work, along with any other XML that is generated by WordPress as well as the RSS feeds. The “error on line 3 at column 6” will no longer mess up your WordPress website’s sitemap.xml.

You may post a comment in case this solution does not work for you, but it will likely not come to that because it has been verified to resolve the mentioned issue.

Share this post

Facebook Twitter LinkedIn Google +

Comments (19)

  • Mads Reply

    I can´t download the fil, please mail it to me

    B/rgs Mads

    May 25, 2016 at 6:50 pm
    • Alex Reply

      Sorry, Mads
      Now you can download the archive

      June 13, 2016 at 8:01 pm
  • fairy Reply

    Very Helpful,
    Thank you so much for sharing

    November 21, 2016 at 1:42 pm
  • youness wardaoui Reply

    Thank you Allarroa

    January 11, 2017 at 10:46 pm
  • Giusy DRAMMIS Reply

    THANK YOU!!
    Giusy

    June 16, 2017 at 1:15 pm
  • james Reply

    Thank you. This has saved my bacon

    September 21, 2017 at 10:53 am
  • Rajik Khan Reply

    Thank you So Much Work 100%

    October 17, 2017 at 3:28 pm
  • can ho gia re hcm Reply

    Thank you So Much Work 100%

    April 3, 2018 at 8:18 am
  • dhron Reply

    worked for me thanks

    May 18, 2018 at 8:32 pm
  • Bishwa Prakash Reply

    I have above procedure completely for fixes but didn’t get any result. I am still getting the error “error on line 3 at column 6: XML declaration allowed only at the start of the document”.

    Could anyone please help on this ?

    July 11, 2018 at 11:42 am
    • Bishwa Prakash Reply

      thank you everything works

      July 11, 2018 at 12:41 pm
  • Deepak Reply

    This isn’t working for me. What do you mean by “refresh the sitemap.xml”? Is it just refresh the sitemap page in browser (which is what I did), or something else?

    January 1, 2019 at 9:30 am
    • Alex Sky Reply

      Oh yeah
      it’s just an refresh
      try CTR+F5

      January 2, 2019 at 12:35 pm
  • Saira Reply

    ohhhh thanks allot you solve my issue really appreciated your help

    February 5, 2019 at 9:49 am
  • Sagar Basnet Reply

    this is so helpful for me thanks a lot.

    June 18, 2019 at 10:52 pm
  • Thành Thái Blog Reply

    Thank you, i follow you and my website fix ok.
    Thanks very much

    July 10, 2019 at 11:19 pm
  • Nena Carreira Reply

    Hi
    I tried your fix, It’s still not working .Can someone help me?

    July 30, 2019 at 6:21 pm
  • Alena Reply

    thank you everything works

    September 2, 2019 at 9:31 am
  • Mr Mahbub Reply

    Hello Dear, We’ve written an article about common sitemap errors which you can find here. Solution is very easy and it will work 100%.

    April 28, 2020 at 11:40 am

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *


Related Posts

Composing A college essay - How To Compose A college essay That Gets You An A+

Composing A college essay – How To Compose A college essay That Gets You An A+

Composing A college essay - How To Compose A college essay That Gets You An A+ read more

5 Tips For Business Blogging To Get You More Customers

5 Tips For Business Blogging To Get You More Customers

5 Tips For Business Blogging To Get You More Customers read more

The Many Benefits of APM

Application performance management is a wide discipline that encompasses multiple sub categories, such as server monitoring and infrastructure monitoring. The best... read more

InstaPress – Our Premium Child Theme Debut

A picture is worth a thousand words! It’s been a week of many victories for us. We celebrated our first... read more

Is Your WordPress Safe Enough?

Is Your WordPress Safe Enough?

Is Your WordPress Safe Enough? read more

What are the things to consider while hiring a web design Company?

When you are refreshing or ultimately making new web design and building, there are many factors one has to... read more

Help us help you!

PressWork version 1.0 is here, now the real work begins. Now that PressWork version 1.0 is here we need your... read more

Introducing PressWork child themes

We design premium child themes too! We are currently hard at work building our first 3 child themes for PressWork:... read more

Welcome to PressWork

PressWork is a free, open-source theme framework built for WordPress 3.2 using HTML5 and CSS3. It was created out... read more

Building an Empire with PressWork

What’s Empire Avenue? Empire Avenue is the Social Stock Market, where you can Grow your Social Capital online. Here’s how... read more

ADS

info@hmsite.net

  • WordPress Themes
    • About WordPress
    • How to install
  • Our Blog
  • WordPress Hosting
  • Contact
  • Theme PressWork
    • Welcome to PressWork
    • Showcase
    • Features
      • Briefcase
      • Widgets
    • Pricing made easy
    • Documentation
  • Frequently Asked Questions
  • Terms
  • About
  • Submit
Order website creation
lawyer-and-attorney-wordpress-theme
20+ Best Lawyer WordPress Themes in 2019
Top 20 Premium WordPress Themes for Maintenance Services Websites
Why Wooden Accessories Are a Better Choice Than Plastic
Browser-based games – trends and development tips to keep in mind when choosing your WP themes
Choosing the Best Website Builder – What Software to Choose for Launching a Contemporary Site?
20 Best Industrial and Manufacturing Word-press Themes
How to Have a Successful Website that Converts
What are the things to consider while hiring a web design Company?
Best Popups For Your Website From Weblium Website Builder
Best Popups For Your Website From Weblium Website Builder
How to make your WordPress Website SEO friendly in other languages
Promote Your Music on Social Media Without Annoying People
Improving Your Web App Performance
Improving Your Web App Performance Easily and Quickly
A drawing of a website with different aspects of it highlighted.
Benefits of a website analysis
The Many Benefits of APM
Selecting the Perfect WordPress Theme – 5 Things You Should Consider
Is Your Website Discoverable by Search Engines? Here’s How to Tell
plugin WP Reset
WP Reset – Best Reset WordPress Plugin
Order website creation

Tags

About WordPress Audio bar Blog Business Case Study change the color CMS Content design documentation Edit Empire Avenue events Evolution How To Human Web instapress links Localization of wordpress photoblogging premium themes presswork Pressworks Themes seo Showcase sidebar Site social media themespw Three Column tips ToolBox Video web design Web Hosting website widgets WordCamp wordpress WordPress Site WordPress Theme Wordpress Themes youtube zigzag
  • About
  • Blog
  • Themes
  • Pricing
  • Features
  • Terms
  • Support
  • Showcase
  • Contact
  • BriefCase
  • Categories
  • Documentation
  • Widgets
  • Submit
  • How to install
  • Sitemap
WordPress Themes – PressWork © 2011-2018 PressWork.me All Rights Reserved Created using WordPress themes e-mail: info@presswork.me