Somewhere along the line a new line was being placed before the XML declaration in the feeds. This caused an error to display in Firefox and other browsers instead of the feed.
I searched high and low to find where it was coming from. Disabled all me plugins, removed blank lines from code etc. To no avail. Then I noticed that the error was happening on a Mac but not in Windows. So it had to do with something about how Windows, Mac, and Linux/Unix deal with carriage returns and new line characters. I didn't think I'd ever find the ghost new line (or return) so I tried to find a way to delete it.
Here is the hack/fix. What I've done is start an output buffer, and then clear it before the XML/RSS template is loaded.
In the index.php file put ob_start() like this:
<php
ob_start();
In wp-includes/functions.php add ob_end_clean() to the beginning functions that load the feed templates.
/**
* Load the RDF RSS 0.91 Feed template.
*
* @since 2.1.0
*/
function do_feed_rdf() {
ob_end_clean();
load_template( ABSPATH . WPINC . '/feed-rdf.php' );
}
/**
* Load the RSS 1.0 Feed Template
*
* @since 2.1.0
*/
function do_feed_rss() {
ob_end_clean();
load_template( ABSPATH . WPINC . '/feed-rss.php' );
}
/**
* Load either the RSS2 comment feed or the RSS2 posts feed.
*
* @since 2.1.0
*
* @param bool $for_comments True for the comment feed, false for normal feed.
*/
function do_feed_rss2( $for_comments ) {
ob_end_clean();
if ( $for_comments )
load_template( ABSPATH . WPINC . '/feed-rss2-comments.php' );
else
load_template( ABSPATH . WPINC . '/feed-rss2.php' );
}
/**
* Load either Atom comment feed or Atom posts feed.
*
* @since 2.1.0
*
* @param bool $for_comments True for the comment feed, false for normal feed.
*/
function do_feed_atom( $for_comments ) {
ob_end_clean();
if ($for_comments)
load_template( ABSPATH . WPINC . '/feed-atom-comments.php');
else
load_template( ABSPATH . WPINC . '/feed-atom.php' );
}
This worked without the change to the index.php file, but I don't think it should have.
I tried to accomplish this with a plugin, but it wouldn't work. since this is editing Wordpress core files, these changes will need to be made again after an upgrade if the problem persists with the new version.