April 5th, 2008Wordpress Feed Issue: Blank line before XML declaration
Gosh! Yet another issue in my Wordpress!
This is the third time in less than two weeks that I had to troubleshoot my installation of Wordpress 2.5.
This time, however, the issue was not with Wordpress itself, but this particular theme that I am using – Illacrimo. The feed for this blog was throwing an error:
XML Parsing Error: xml declaration not at start of external entityLocation: http://www.sawantshah.com/feed/Line Number 2, Column 1:<?xml version="1.0" encoding="UTF-8"?>^
I learned about the error when I tried to burn my feed through FeedBurner, which informed me that the feed (RSS XML) was not well-formed:
The URL you entered does not appear to be a valid feed. We encountered the following problem: Error on line 2: The processing instruction target matching “[xX][mM][lL]” is not allowed.
It directed me to Feed Validator to check the feed’s validity, and for sure it was not well formed:
line 1, column 1:
So what now? Google zindabad! On Wordpress Support I found this and this, but I didn’t find any concise and to the point answer there.
I found a concise and workable solution on W3C’s site – check it out.
Why does this error occur?
If an XML declaration (<?xml ... ?>) appears in your feed, it must be the first thing in the feed, before any whitespace.
Unfortunately, with WordPress it seems all too easy for a plugin, a theme, or for your configuration file to contain a blank line. Further compounding this problem, some — but not all — feed readers compensate for this common error, allowing the error to go undetected for quite a while.
What’s the solution?
The solution is to trim/delete any blank lines outside of the <? ... ?> in the PHP code of either the theme files (functions.php) or Wordpress files (wp-config.php, wp-rss2.php, wp-atom.php).
I had a blank line between two PHP code sections in the theme’s functions.php file. It was not evident at first, but thankfully, I finally got it to work! Now my feeds are working fine.
So go ahead and subscribe!




April 6th, 2008 at 12:12 pm
i do not use the default rss in wp… i just used the feedburner which works ok with me, but sometime slow update.
April 6th, 2008 at 12:13 pm
oh by the way sawantshah, may you have a successful new blog ya
good luck!
April 6th, 2008 at 12:14 pm
one more thing, i subscribe you rss for easy updates
sorry for the so many comment, i hope i do not float in your blog :p
November 13th, 2008 at 11:45 pm
Thanks for the pointers. I’d left a blank line after the ?> tag in a plug-in I’d copy-pasted recently. So if you can’t find it anywhere else, think of what you recently installed.
December 14th, 2008 at 3:02 pm
@Ash: Thanks for dropping by and for the valuable tip.
January 15th, 2009 at 10:30 pm
Thanks for the heads up.
January 28th, 2009 at 7:08 pm
Thanks for the help, the RSS feed works again, the error occurred with a faulty plugin (bulk admin something), removed it and everything works again.
June 29th, 2009 at 4:39 am
Nice post! Very complete and detail information. That
July 22nd, 2009 at 8:29 pm
thanks – this worked for me
April 28th, 2010 at 4:01 pm
I zhink in the new version the probleme is gone. Thanks for the work.