WordPress : how to remove white spaces and fix problems of RSS feeds
To solve white space of WordPress RSS feeds problem (« The URL does not appear to reference a valid XML file… »), you must :
– edit « wp-includes/feed-rss2.php » WordPress file :
– find on the top of the file the lines
« header(‘Content-Type: text/xml; charset=’ . get_option(‘blog_charset’), true);
$more = 1; »
– add just after these lines the following code
$out = ob_get_contents();
$out = str_replace(array(« \n », « \r », « \t », » « ), « », $input);
ob_end_clean();
Do the same with the file « wp-includes/feed-rss2-comments.php »