I have finally figured out why the RSS feed on this blog had died. I had been assuming that it was due to an illegal character in one of the post headings because that is what broke it last time; XML is very fussy about character set.
Today I had a look at the source of the XML that wouldn’t display and spotted that there were two blank lines on the front. Removing those (by hand) fixed it, I said XML was fussy!
Now where were they coming from. A search on Google for “wordpress xml blank lines” came up with a few suggestions and it looks like it is a common problem but everyone has to figure it out for themselves; there is no FAQ. The prime suggestion was blank lines on the end of the wp-config.php file but that wasn’t the case for me. The next was in functions.php in the theme; BINGO. I am always very verbal when writing code and put in lots of comments and white space. Normally that doesn’t matter but functions.php is loaded for every action (even for the admin panels) and PHP is a strange beast—everything that is not with us is against us; i.e. everything that is not a PHP statement is directly output to the stream so blank lines before the first < ?php and after the last ?> is output and you cannot separate the functions outside of the PHP structure either. Once I had fixed that then it was all ok.
I still can’t figure out the source of the two blank lines that cause the Comment feed to fail! [Update: that is fixed too. Same problem, just that I hadn’t properly cleared the browser cache.]