Error on line 3 at column 6 Sitemap Fault



Back in 2010, a problem had arisen where WordPress would cause an error to appear in the browser whenever loading the RSS feed. “Error on line 3 at column 6 Sitemap Fault”

Error on line 3 at column 6 Sitemap Fault

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”


Error on line 3 at column 6 Sitemap Fault Fix Solution



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 “sitemap-fix.php” that you can download.

Step #2: Once you have downloaded the above “sitemap-fix.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 “sitemap-fix.php” file into the plugins or root folder; it needs to be placed in the Theme’s folder.



Step #3: “After uploading the “sitemap-fix.php” file to the theme folder, you need to edit the “functions.php” file. In the “functions.php” file you will need to add the following code directly above the last line. So the last two lines of your “function.php” file will look like this:

In other words, it should look like the following:

include ("sitemap-fix.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 “sitemap-fix.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 “sitemap-fix.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.

POPULAR TOPICS

COMMENTS