WordPress 3.0 might have feed errors. Fix them!
WordPress 3.0 is the new current hip. Everybody is switching to the new platform while fearing crashes or great upheavals in the world of blogging. I’ve been a bit worried about all this for some days before taking the leap of the full WordPress 3.0 upgrade. Everything went on really fine until…
Errors through CommentLuv.
I was commenting on a blog I usually visit. When I activated its CommentLuv app, I was greeted with a “No last blog post found” error that got my eyes growing like saucers before starting squinting in pure disbelief, as if staring for 2 minutes at the error message would give me explanation. First thing I did was to check my RSS feed where I found a nice error on line 5 at column 6: XML declaration allowed only at the start of the document error. It dawned to me that the WordPress 3.0 update might have generated this error.
Recurring feed error.
After some research, there seems that this type of error is frequent in WordPress, whatever the version. So I went out to try several feed correcting plugins for WordPress but whatever the solution tried (even that of clearing all WordPress files from blank lines) it didn’t seem to be able to clear the errors out. According to all that I read, it all comes from some trailing blank lines in the feed code. Having tried everything in vain, the only solution to this was to go back to the good old hand coding.
The fix.
Fixing this error was not an easy task but I found an article over at www.w3it.org. The code is fairly simple and its implementation is easy. All in all it takes the feed generated by the WordPress core and clears it all up from any blank line held around.
What you need to do is to open this file:
wp-includes/feed-rss2.php
Open this file in a text editor and look for this line:
header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
$more = 1;
Just underneath it add this code
$out = ob_get_contents();
$out = str_replace(array("\n", "\r", "\t", " "), "", $input);
ob_end_clean();
That’s all! Short and sweet. This code clears all empty lines and hey presto, your feed is restored.
Other feed files?
You might be asking why the wp-includes/feed-rss2.php file? Just because it is the one that is really used in the WordPress feed. You can however do like I did, I opened all the other feed files and stitched them up with the same code.
A final word.
What came out of my perusals over the web on this issue is that the “blank line” error can be generated about anywhere in all the WordPress core or theme files. The current solution corrects all of these in one go but calls for hacking the feed. You’ll find different sources, hacks, solutions or what not on the subject out there and each might have a different root so take a good look at all the possible bugs before testing any solution around.
About the Author:
Sachin D. Brojmohun has extensive experience in terms of graphic design, CSS integration, usability and accessibility as well as in SEO. More about him and the Web Design Bureau of Mauritius here: Web Design Mauritius.

Twitter: blebon
says:
I use FeedBurner and no feed errors at all, even with CommentLuv (as you can see) :s
Bruno recently wrote:
UK emergency budget
Twitter: web_design_mu
says:
As I pointed out in the article, this might be specific to some blogs and as FeedBurner uses the feed generated by the WordPress code, it would be useless when trying to burn the whole thing. I have a FeedBurner feed too but if its given a broken RSS, it doesn’t work.
Web Design Mauritius recently wrote:
Year 3, cranky but working.
Twitter: blebon
says:
Weird … it aint broke on my installation. Good then
Bruno recently wrote:
UK emergency budget
I have not updated to wp3 yet on but have been testing wp3 on subdomains. I find the previous look (dashboard look) much better. This one is too light and you know am not such a fan of light colours :S
By the way thanks for sharing the tip above. Bookmarked in case I get this error soon.
Kurt recently wrote:
Should I Buy My Own Domain Name?
Twitter: web_design_mu
says:
I knew that you would still be testing it. The back-office is a bit strange but you do get used to it. Keep me posted if you get any error.
Twitter: dragonblogger
says:
Very interesting, I hadn’t noticed an issue yet with any of my feeds after upgrading to WordPress 3. I upgraded all of my blogs and haven’t seen issue yet.
Twitter: web_design_mu
says:
Thanks for stopping by Justin. As I said in my conclusion there might be different causes to this error, like an incompatible plugin for example, and you never know. It might all go on smoothly or get busted, I had the second issue
.
Thanks for sharing this. Even though I haven’t experienced errors with wordpress 3.0 yet. I will still bookmark your site for reference in the future. Thanks a lot.
Twitter: web_design_mu
says:
Thanks for your comment. Please inform me if you come across this error. Cheers!
i got two problems with my wp 3
1 :- comments goes automatically on other post ..
2:- also a problem with image caption code
can u help me …..
Twitter: web_design_mu
says:
Hi Gopal,
It seems that all the errors that crop up from WP 3 are plugin related. Try to deactivate your plugins to see if your pages work fine. Try to temporarily change your theme too, just to see how things are moving. This will help you find where the problem is originating.
You can use this article also as a reference.
Best of luck.
i will try this…………
Twitter: netchunks
says:
I have already upgarded to WordPress 3.0 and have not been getting any kind of error in it. Not even the feed one you mentioned. Must be some incompatible plugin eh!
Shiva | Web Magazine recently wrote:
CouponPress and PremiumPress Discount Coupon Code – July UPDATE-
Twitter: web_design_mu
says:
Good for you Shiva. This must come from some plugins. Weird thing is that I’m getting quite a lot of traffic for “WordPress 3.0 feed error” coming from Google. Looks like many people are using “breaker” plugins.
I had this problem, and your solution worked. Thanks!
Twitter: web_design_mu
says:
I’m happy that this has been of some help to you Peter. Thanks for your comment.
Thats a superb info for wp users.
A few days back updated to wp3 but have not found this prob i checked the link http://designcreed.biz/feed/ for feed… but will keep in mind.
Twitter: web_design_mu
says:
Thanks and welcome on the Bureau Livio.