In my previous wordpress project when I check the wordpress feed there was a “XML Parsing Error: XML or text declaration not at start of entity”.

XML Parsing Error On Mozilla Firefox

firefox-feederror

XML Parsing Error On Google Chrome

chrome-feederror

Here it shows some more information.

Then I started to search solution. I searched around various forums and blogs for possible causes and found that it was most commonly caused by a Blank line before XML declaration.

This error arises if there is a whitespace before an XML declaration () appears in your feed. The blank line error means that the code has blank lines in it, which can be easily introduced in the WordPress php code by a plugin, theme, or any configuration file.
So basically I had to go looking for blank lines before PHP starting tag

<?php
and after the PHP closing tag
?>

Steps to Solve this problem

1]Deactivate All WordPress Plugins

First deactivate all the wordpress plugin to check If any plugin causing the problem. If you find any plugin from the list cause this problem then check the plugin files to check blank line in there code.
If you cant find the problem by doing this then again reactivate them.

2] Check the Theme configuration File

Then check the function.php file in your theme folder as it is configuration file for your theme and it contains functions related to your theme. So check the PHP code for the blank line and save the changed file and again Upload it.
If the problem is in this function.php file then you can see your feeds running without the XML parsing error.

If you still cant find the problem then you can use Fix RSS feed WordPress Plugin
which promised to search all folders (except wp-admin and wp-includes directory) if the php file has blank lines in the head and tail line, and then delete blank lines. The plugin author writes that it will delete php files at only the beginning and end of the blank lines, and will not delete the blank lines between documents, so it will not affect the operation of the php programs.

Similar Posts