I recently got the nasty “XML Parsing Error: XML or text declaration not at start of entity Location” error instead of RSS feed on two client WordPress sites.
First, I tried the Fx-RSS-Feed plugin. No luck! it identified several hundred WordPress and theme files with unnecessary whitespace. Most of the files were write-protected. Way too much work for me to change all the permissions, run the plugin, and change them back.
Instead, I used the fix at Wejn’s lair. Scroll down the page and download the file “wejnswpwhitespacefix.php” or get the text version here.
Upload the PHP file to your root directory, then add this line to your index.php file:
The only downside is that auto-upgrading your WordPress installation will overwrite the index.php file. You will need to re-insert the extra line of code. Instead, you might try the htaccess file modification described in the head of the file.