While trying to make WordPress and Mailchimp work better together, I was having a hard time getting Mailchimp to accept my blog’s RSS feed. After some research, I noticed that the XML wasn’t formatted properly, as the feed was emitting a blank line before the XML declaration. Many of the other help docs I found online recommended hunting for extra lines in my theme’s functions.php file among others. After a few minutes of that nonsense, I figured there must be a better way. I knew that I didn’t want anything output before the xml declaration, so I figured if I just cleared the output buffer prior to echoing the xml declaration, that should do the trick. Sure enough, it worked.
Insert the following line just prior to xml declaration: