Fix WordPress Feed XML Parsing Errors (XML Declaration Not at Start)
Is your WordPress RSS feed showing “XML Parsing Error: XML or text declaration not at start of entity“? It happened to us in 2009: our feed stopped loading in every browser and FeedBurner stopped updating, yet Google Reader kept showing our posts, so we only found out when a friend told us. The cause was a blank line before the XML declaration. Here is how to fix WordPress feed XML parsing errors, updated for 2026.

Quick answer: This WordPress feed XML parsing error almost always means something prints output before <?xml, usually a blank line or space before <?php or after ?> in your theme’s functions.php, wp-config.php or a plugin, or a PHP warning. Find it by switching to a default theme and disabling plugins, remove the extra whitespace (and drop closing ?> tags at the end of PHP files), clear your cache and validate the feed.
Table of Contents
What the error looks like
Firefox shows the XML parsing error with “Line Number 2, Column 1”. Chrome says “XML declaration allowed only at the start of the document”. Both mean the same thing: there is something before the first line of the feed.

XML Parsing Error: XML or text declaration not at start of entity
Line Number 2, Column 1How to fix WordPress feed XML parsing errors
- Check the feed. Open yoursite.com/feed/ and test it in the W3C Feed Validation Service. If the first line is blank, you have this problem.
- Clear caching first. Turn off or purge your caching plugin and CDN so you see the live feed while testing.
- Deactivate plugins one by one, or use the Health Check & Troubleshooting plugin, which disables plugins only for you without affecting visitors.
- Switch to a default theme like Twenty Twenty-Five. If the feed works, the problem is in your theme.
- Remove blank lines before the opening
<?phpand after any closing?>in functions.php, wp-config.php and plugin files you have edited. The modern best practice is to leave out the closing?>at the end of PHP-only files, so stray whitespace can never be sent. - Check for a BOM. Some text editors save files with an invisible byte order mark. Save as “UTF-8 without BOM”.
- Look for PHP warnings. With WP_DEBUG on and errors displayed, a warning printed at the top breaks the feed. Log errors to a file instead of displaying them on live sites.
What fixed it for us
Disabling plugins did not help. Over FTP we found blank lines after the closing tags in several files, including wp-config.php, and a blank line at the end of our theme’s functions.php, which we had edited recently to separate trackbacks from comments. Removing the blank lines fixed the feed instantly.

Today, do not edit WordPress core files; update WordPress instead, as current versions do not ship with this problem. Make theme edits in a child theme so updates never undo them.
Update services that read your feed
After fixing the feed, force services to fetch it again. If you use FeedBurner, see how to fix FeedBurner feeds not updating. Email newsletter tools and feed readers usually pick up the fix on their next check. Many readers are forgiving and showed our posts even while browsers failed, so check your feed in a browser regularly. Our list of popular feed readers shows what your readers may be using.
FAQ
Why does my WordPress feed show a blank first line?
A theme or plugin file outputs whitespace before the feed starts, usually from a blank line around PHP tags.
Does this error hurt SEO?
Search engines can still crawl your pages, but feed readers, email services and podcast apps may stop updating.
Is there a plugin to fix it?
Old “fix RSS feed” plugins stripped blank lines from PHP files automatically. It is safer to find and fix the actual file.
Get our free weekly email: new tech guides and tools, no spam.
New and updated tech guides, a free tool worth bookmarking and one useful pick, once a week. No spam, unsubscribe anytime.
One email a week. Unsubscribe anytime. See our privacy policy.







I got rid of this mess by spending only 5 bucks on Fiverr.
https://www.fiverr.com/categories/programming-tech
Thank you for the excellent tutorial with screenshots and a clear explanation! As a marketer and non-PHP coder, the discussions on the WordPress support forums about this issue that said “remove whitespace from PHP files” left me confused. Seeing your actual screenshots of where you removed the whitespace “line” was really helpful.
Also, note to others to check your built-in WordPress code editor and not just the PHP files via FTP (Appearance > Editor). It was my functions.php file too but making the change via FTP in both my main and child themes didn’t override what was appearing in functions.php in the built-in editor.
hello admin, i have problem like your posting, thank you, i will try..
I am getting the same error but I just have a web applicqation with no php files. Can anyone help me ???
Thank you. I had added some stuff to my functions.php file and left a couple blank lines at the end. I deleted them and resynced my feeds. Now they work.
Would have never guessed this was the problem! Much appreciated!
If this method doesn’t work because you have a heavily customized theme with a lot of php and room for error, follow these steps….
https://fail.ghost.org/
Thanks, friend! My blog feeds were not working, with this same error you told above, and this was also preventing my Newsletter from being sent automatically (it’s feed driven).
I edited my functions.php file as you suggested, and it worked first time! You saved my blog! :D
Helped me out too, thanks!
Many – many thanks to you for this article ..it helped me a lot!
Thank You!!! I had 2 lines of blank code at the very end of my functions.php file.
“Feedburner account > Troubleshooting > Resync Feed” This option regenerated my Feedburner Feed, but the feed in my site by the address mysite.com/feed still doesn’t work!
WordPress have 1000’s of php files, I can’t check them all!
The php closing tag ?> is not necessary at the end of a file. Get out of the habit of using it, and delete it when you find it. This applies only to ?> at the end of a file. Naturally you need it within a file where text is mixed with php.
Almost all white space problems are caused by white space characters, usually a newline, after the ?> at the end of a file. This is harmful in many situations, not just feeds.
When you omit the ?> at the end of a file, you cannot (obviously) have white space after it. And white space before the close is harmless.
Thanks a lot…
This guide is the best step by step guide on fixing an RSS feed… I sat unable to do anything for a few weeks…. fixing my feed..
ultimately it was ur guide that led me to find the problem.. that was ultimately in my functions.php…
thanks a ton again…
If you disable all pugins, resinstall wp with latest updated fresh files, and use another theme, but problem still there, you will have to remove feed cache from your database:
DELETE FROM `wp_options` WHERE `option_name` LIKE (‘_transient%_feed_%’)
Excellent, +1, this is a very useful article, I was looking for one solution, you gave me serveral :)
Thanks dude !
Another alternative is use ob_clean(); method just before you want to return your results, this will clean the output buffer so that even if any empty lines going to output, it will be erased before pushing your response
This works perfect for me! Thank you
Yes. So am I. I got that error at function.php..thanks
Hello,
Iam getting a different type of error in my wordpress feed: techblazes.com/feed which says: error on line 660 at column 30: Input is not proper UTF-8, indicate encoding !
Bytes: 0x1C 0x4F 0x70 0x65
This made my feedburner feed to stop working correctly. Please help me..
Thnks a lot! was looking for solution for ages ))
thank a lot, this helped me a lot
I dont know how can i thank you for this post
i fixed my rss feed problem by wordpress rss feed fix plugin that you put in the post
thank you very very very much
Yep, functions.php here as well.
Thanks so much for your work!
Hi
I did all what your post says and I still have the error.. any ideas what it could be?
Parse your feed to some XML validator: maybe it will help. Not only blank line could break your rss.
There are many ways to fix this.. Read the below article..Nice one
https://www.globinch.com/wordpress-rss-feed-xml-parsing-error/
Thanks for the post. I have read about the whitespace problem. And rereading it made me check again and fixed my problem (that I overlooked). Just wanted to say thanks.
I found this problem to actually be BLANK LINES at the end of the FUNCTIONS.PHP file. Delete those lines.
I just like to say thanks for this info. I am still trying to fix my RSS Feed, but your info has been very helpful. Fingers crossed!!
yes its function.php problems.
i’m fixed the FSS feed error.
thz all.
Wow, great post. I was having problem with wordpress for Blackberry and it wouldn’t work, then i found you post, now my blog is accessible from my Blackberry again “blackberry uses xmlrpc”
Thanks,
uff… you save my life… y tried with the plug-in and doesn’t work, so i start editing all the archives of my template and the ftp server and done! all came back to normally
Man, I wish this was as easy as it being a functions.php problem! I went through all the steps but STILL get the same problem as originally described. I am baffled and do not know what to do next!
Many thanks to you QOT for this article ..it helped me a lot!
thank you for this post!
I finally located the culprit – functions.php – that was causing me headaches.
Josh L,
This was the same issue we were having. Thank you for pointing out that spaces between php tags can cause this same malfunction.
Thanks for this post! In my case, it was also the functions.php file, but it was a blank line between two blocks of PHP, rather than at the beginning or end of the file.
Hi there,
I have been looking for some information wth regards to xml errors in wordpress. As I produce articles, now and then, I create errors by accident.
Is there anyhting that I can do to correct these errors automatically or do these have to be manually corrected.
You seem like the right person to ask and so I hope I have not hijacked your post with my queries.
All the best
Kazooli
Turned out it was the functions.php for me, as well.
I totally forgot that I had edited it just before upgrading to WP 2.8.4 for a cleaner function…and ended up creating a bunch of needless extra research for myself, to resolve the problem.
For those of you who didn’t fall into the “functions.php” category…
You might want to give the Fix-Rss-Feed plugin a try, it quickly removed blank lines from most .php files in the WordPress directories and would save you a lot of time:
https://wordpress.org/plugins/fix-rss-feed/
Just wanted to say thanks for mentioning the functions.php one…I am astonished I missed it.
Cheers,
Michael
Your article help me to slove the problem.SO would you mind me to translate it to Chinese?
Yes most of the times the problem is in the function.php file or in the plugins files.
Yep, functions.php here as well.
Thanks so much for your work!
I had the same problem… and the fix it. i’m install fix-rss-feed plugin. It works!
Update: Yes it was the functions.php that was the culprit.
Thanks heaps!!!
Looks I have been hit too! Will check out tonite. I did customise my theme a lot lately with conditionally tagging in WP and I think this could have caused.
Thanks for writing this up.
I was clueless about this :) but did remember you writing about this.