No More Invalid RSS
When I made this site, I spend hours figuring out why my feed wasn’t working. There are several examples in the Wordpress Support Forums telling, that feeds aren’t working because of a blank line in the beginning of the feed before the XML declaration. Some feedreaders have no problem with this, but Feedburner does. And Feedburner is very important.
Well, let’s get to it! The fix was found at Wejn.org and is very simple to use. First of all, you need to download the script file, called wejnswpwhitespacefix.php and upload it to your blog’s root (in the same folder as index.php. Then, get your index.php file. It usually looks something like this:
<?php define('WP_USE_THEMES', true); /** Loads the WordPress Environment and Template */ require('./site/wp-blog-header.php'); ?>
Now, right before define('WP_USE_THEMES', true);, add include("wejnswpwhitespacefix.php");.
This will call the script, which removes every character that isn’t text before the XML declaration in the RSS files, and before the DOCTYPE declaration in the theme files.





Worked like a charm.
Thanks.
Uh, never mind! It fixed itself over night!
Hi Peter,
Thanks for this – this trick worker perfectly in fixing my broken rss feed. Unforunately, it broke my comments feed worse! Before the fix both feeds had the same problem – an extra, blank line before the XML declaration. (Validation in the comments feed showed there was an additional error further down the page, but at least it attempted to validate). Both feeds got through to Google Reader.
Now the feed for posts works fine, but when I try to validate the comments feed, it gives me: “It looks like this is a web page, not a feed. I looked for a feed associated with this page, but couldn’t find one” and an internal server error.
When I revert to the original version of the index.php file, both feeds go back to their original, broken state. Any insight on why this fix might effect my comments feed in this way would be greatly appreciated!
Hi Matt,
I’m glad the trick worked out for you in the matter of fixing your RSS feed. I have never used my own comment feed, but tried to sign up for it in NetNewsWire, my feed reader, and it shows up fine. How are you validating it?
i try this method but this method redirect my feed to igoogle
Hello!!! this method didnt work for me… do you know any other?
No, unfortunately I do not know any other method for removing the blank lines, other than looking through all your theme files (especially functions.php) and removing them manually.
Are you sure you uploaded wejnswpwhitespacefix.php into your root folder? That is, not your theme’s root, but the root of the Wordpress installation.
Make sure it’s right after define(’WP_USE_THEMES’, true); that you include this:
include("wejnswpwhitespacefix.php");.Let me know how it works out for you.