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:
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.
Adam
May 1, 2012 at 10:32 amGreat, it worked
Thanx very much. Cheeeers
Traditional Painter
April 21, 2012 at 12:51 amCheers for the tip, finally got my Feedburner feed to validate, them pesky blank lines are gone
Filipe
September 16, 2011 at 2:53 ammate it worked perfectly. You should be covered in gold
simona
November 21, 2010 at 8:17 pmthank you very much!!!
Tracy
July 23, 2010 at 6:12 amWhere do I insert your code to fix?
My index.php looks like this:
Farzad
June 13, 2010 at 10:43 pmYes , my site is also blank . It means my home page is blank
James E.
May 6, 2010 at 1:38 amI attempted this trick to remove the extra white space from my files after I had to delete malicious code from all my php pages. Unfortunately, now the main page of my site is just blank.
I am confused, in your post you state to place it above the WP_USE_THEMES definition, and later you say below. I’ve tried it in both places with the same result.
Peter
May 7, 2010 at 8:37 amI must say, that I can’t find the place where I say it should be placed below. It should always be placed in the beginning of the file. Just after
< ?phpand beforedefine('WP_USE_THEMES', true);Oliver
January 19, 2012 at 8:52 pmSorry but I am confused about this. Does this mean that I have to insert the wohle code of the script between the lines <?php nad define (… ?
This makes no sense to me as Wejn´s code starts with a <?php n also.
So what is the 1 line of (Wejn´s) code to insert?
cheers!
Jon
February 1, 2010 at 5:23 pmCheers. Needed this to fix a client site. Worked a charm.
Zil-el-Saif
November 2, 2009 at 10:13 amWow! I just thinking reinstalling my blog and found this post!
Thank you!!!!!!
Vats Thakur
September 7, 2009 at 9:27 pmReally nice,thanks!
Mark
May 28, 2009 at 10:37 pmWorked like a charm.
Thanks.
mattyoungmark
May 2, 2009 at 4:22 pmUh, never mind! It fixed itself over night!
mattyoungmark
May 1, 2009 at 10:34 pmHi 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!
Peter
May 1, 2009 at 11:03 pmHi 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?
Bio War
February 6, 2009 at 5:22 pmi try this method but this method redirect my feed to igoogle
Bio War
February 6, 2009 at 5:21 pmHello!!! this method didnt work for me… do you know any other?
Peter
February 7, 2009 at 10:47 amNo, 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.