What’s Wrong?The problem is quite easy to resolve if you are a programmer who considers the unpredictable and any RSS reader developer should consider this. The fast and dirty fix is to TRIM the resulting feed (XML file) and that’s it! The problem is resolved. In a few minutes I added this fix to the resulting feed on our WordPress file.
How To Fix This for WordPress?The file in charge of creating the content is feed.php but the file which loads the header is a small file located in the WordPress root folder, /wp-blog-header.php. This file has a line which calls the required file and adds the header to that. See the below line: Now, I don’t care where the XML file gets the extra line, which cases the feed to become invalid, but I’m using a simple function from PHP, ob_start. The PHP.net website is quite informative about the function:
This function will turn output buffering on. While output buffering is active no output is sent from the script (other than headers), instead the output is stored in an internal buffer.Now, how about a few modifications to the wp-blog-header.php file?