The ubiquitous WordPress RSS Feed Errorand a relatively easy site-wide fix for the problem

The Error:

On WordPress.org blogs, a common error occurs due to the insertion of a blank line at the start of the file for an RSS Feed. The error message typically says something like:
XML Parsing Error: 
XML or Text Declaration Not at Start of Entity
Line Number 2, Column 1:
<?xml version=
This error is displayed when someone using FireFox clicks on the RSS Feed link for the Entries or the Comments of some WordPress blogs.

Sometimes the error inserts a blank line into the code for all the pages of the WordPress blog. Other times it only does so for some pages.

Insufficient Fixes:

There are several different "fixes" suggested on various webpages for this problem. I tried some of them. They did not work for me.

There is a WordPress.org Plug-in for fixing the RSS Feed problem, but it did not work for me.

Some fixes offer a list of files that you can manually check for errors. These are .php files associated with producing the RSS Feed page in its various versions, as well as some files that have a more general control over the blog. It is claimed that removing blank lines in certain places in the code will fix the RSS Feed problem.

I tried this approach, and it did not work for me. Also, my site had the problem of a blank line inserted in the code of every page. So it could not have been a problem with just the .php file for feeds.

Some comments say that these fixes work. But my concern is that the problem, if fixed manually, may recur. It is a very common problem on WordPress blogs. It seems to be caused by some WordPress themes, and/or some Plug-ins and their settings and options. If you fix the problem manually, it might recur if you add a new plug-in, or change themes, or simply change some of the settings and options on your blog.

So a manual fix, removing blank lines in .php coded files is not a good solution. See the right column for the fix that I prefer.

The Fix:

I can't take credit for this fix. It is from:

Piotr Krzyzek
Marketing Squared
WordPress Remove Blank Line From RSS Feed

Here's how the fix worked, when I used it:

1. I download this file:
wejnswpwhitespacefix.php

2. Then I upload it to my root WordPress blog directory. This folder contains files such as:
wp-blog-header.php
wp-config.php
wp-load.php
and many other php files. It also contains folders such as:
wp-admin
wp-content
wp-includes
The new file goes in the main folder (directory) that contains those other folders listed above.

3. Then I edited the index.php file in that same root folder (not the index file in the other folders) by adding the following "include" code after the "<?php" line, like so:
<?php
include("wejnswpwhitespacefix.php");
I saved the edited file and then upload it to the root directory.

It worked great for my WordPress blog, which for some reason was adding a blank line at the start of every page. This has no effect on the majority of pages on a website. But it breaks XML pages and (I've heard) also Feedburner files.

If you have the same problem with your WordPress blog, I hope that this fix works for you.



Information deemed reliable but not guaranteed. A WebPlaces.org site