Simple FIX for RSS feed validation problem / error – not validating

There’s nothing worse than Googling for what seems like hours for a what should be a simple answer to a simple problem. It happened to me today, so I hope this helps others from the same needless fate.

I noticed on a client site that the RSS feed had a problem and was displaying a validation error, not validating when I tried to check them at feedvalidator.org

I would get this validation error:
line 1, column 1: Blank line before XML declaration

It seems that there were extra spaces before the XML declarations in the feed XML file.

There were tons of suggestions for fixes using plugins and ‘fix’ files, but none of them worked for me. It had to be more simple because I tried deactivating my plugins – that didn’t work. Then I tried switching themes to the default TwentyTwelve – and that worked, so it had to be something in my theme.

SOLUTION:


Turns out it was a very simple problem with my functions.php file in my theme…

There were extra spaces at the end of the functions.php file after the closing php ?> tag.

I just removed all the spaces before and after the closing php tag and PRESTO – all is good everywhere.

Hope this helps some people with an XML validation error. Here’s my post at WordPress.org on the fix.