PHP Code Snippet

If you are seeing the words “error on line 2 at column 6: XML declaration allowed only at the start of the document” when you try visiting your WordPress blog’s RSS feed, then you are not alone. It seems that there are issues with some installations where whitespace amongst core files is causing XML errors. Until WordPress fix this we suggest you follow the following tutorial, using suggestions written by Peter Krzyzek.

Firstly

Firstly download this file http://wejn.org/stuff/wejnswpwhitespacefix.php. We have checked the file and we can assure you it is virus free!

Secondly

Put the file in the ROOT directory of your WordPress installation – i.e. next to the wp-config file.

Thirdly

Open the index.php file in the ROOT directory and add the following code inside the php tags, but above any content.

include("wejnswpwhitespacefix.php");

So your file should look like

<?php
include("wejnswpwhitespacefix.php");
define('WP_USE_THEMES', true);
require('./wp-blog-header.php');

And voila! Your problem with broken RSS feeds should be a thing of the past!