Tonight there is a BIG reason to rejoice in my house, and it’s not JUST because the tornados which visited the Oklahoma City metro area this afternoon missed our house. My good news is this: After two weeks of having my WordPress blog feed broken, it’s FIXED at last! In this post I’ll document, both for your potential benefit/interest as well as my own, the steps I took to remedy this. Before taking the steps which fixed the feed, this is what my direct WordPress feed looked like in both the Chrome and FireFox browsers.

Whitespace error in WordPress feed

FireFox error: WordPress whitespace in feed

The problem with my WordPress blog feed being broken started, I think, when I migrated my website to a new web host. The process of migrating my 30+ WordPress sites to new web hosts is still NOT yet complete, but this problem has been a major sticking point I’ve spent 9+ hours vainly trying to figure out the past week or so, over the course of several days. The support team at WPengine, which is the web host I’m now using for, let me know the problem I needed to fix was that somehow extra whitespace or “line breaks” were being inserted into my WordPress blog feed.

WPE Support Response

I tried disabling all my plugins and also changing my theme, but neither of those ideas worked to fix my feed. I finally fixed the problem by doing two things. First, I removed extra spaces in several of the php files of my WordPress installation, including feed-atom.php, feed-rdf.php, feed-rss.php, feed-rss2.php, and functions.php. I do NOT ‘know PHP’ as a coder, so this was a hit-and-miss exercise. I am sure a lot of the spaces I removed don’t actually matter for my web feed to properly work, but some of them did make a difference. The functions.php file is the longest one of this group, and I didn’t remove ALL the extra line breaks, but I did remove about ten of them. I tried testing my WordPress feed address each time I made a few changes, to see if I could isolate the specific file with the problem, but it never worked afterward.

First functions.php extra line

2nd blank line

The second thing I did which, together with the line break removals, ended up fixing my feed, was to use the wejnswpwhitespacefix.php file on referenced by Steve Workman on his 2010 post about this issue. This fix requires uploading a new PHP file to your WordPress installation, and adding a line of code at the top of my index.php WordPress file.

1 line added

I made all my PHP edits in the free text editing program for Mac, TextWranger. It’s a fantastic little program which I use at LEAST a few times per week. The GREP searching functions of it are outstanding and come in VERY handy when I need to find and replace text patterns in a file, including things like line breaks or paragraph breaks.

After I made those changes, I figured out I also needed to empty the cache of my local web browser to see the ‘latest’ updated version of my feed. Once I did that, wha-la! The feed was fixed. Per the helpful instructions of my WPengine support tech, I made these changes first on the “staging server” of my WPengine site.

As It Should Be

Next, I used my WPengine site controls to copy my ‘fixed’ site from the staging area over to the live site. This took about a minute.

Copy from STAGING to LIVE

When I tested my web feed, it was working as it should! My Feedburner feed was also working again, since it had also been “broken.”

WordPress whitespace error in feed fixed!

I’m REALLY thrilled to have this situation fixed. I strongly dislike situations like this when I spend an inordinate amount of time trying to fix a technical error, and it ends up taking HOURS to resolve it. If you run into something similar to this, hopefully the links and documentation I’ve provided here will help. I love using WordPress for many of my websites, but the need to fix your own problems like this is one of the challenges which comes with self-hosting.

I’ve had my dad report problems with my web feed in the past, and I don’t know if I’ve had this problem longer than a few weeks or not. In the course of my Google research on possible fixes for this problem, I learned that many RSS or feed readers (including Google Reader and Feedly) can actually ignore this feed syntax problem and still resolve/read the feed. Hopefully this is something I won’t have to mess with again. I think when I update WordPress, however, I may have to add that same line to my index.php file again if the updated one is overwritten.

Now, I’ll hopefully be able to post the podcast I recorded 2 weeks ago with Joe Dale! I’ve been waiting to get this silly feed issue resolved first.

Technorati Tags: , , , , , , ,

If you enjoyed this post and found it useful, subscribe to Wes' free newsletter. Check out Wes' video tutorial library, "Playing with Media." Information about more ways to learn with Dr. Wesley Fryer are available on

On this day..

Share →
Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 Unported License.

Made with Love in Oklahoma City