Home » Little Tips » RSS irritations in WordPress

Fundamental Website Setup Links

RSS irritations in WordPress

I’m currently working on adding comic thumbnails to the RSS output of our comic site http://www.onezumi.com, but have discovered a very irritating fact: WordPress does not allow img tags in the description field in the RSS XML. As a result most feed readers will not see the images and won’t display them. (the default Firefox feed viewer being one of them). The img tag does get added to the content encoded element, but that’s less supported right now. So my normal technique is to write up a quick plugin to correct this….but apparently that’s not possible. All of the hooks and actions out there do not allow for this be accomplished. So it comes down to the old fashioned “hack the core file” thing to get this fixed. I hate doing that, but in this case there’s no other way to do it. The actual file to hack (for RSS2 feeds) is located in your wp-includes folder and is called feed-rss2.php. There are two lines in there that have the description element, one for if you are using only an excerpt, and the other if you are doing full text feed. Basically you hack the line to put in whatever you want right after the [CDATA[ part, or right before the final ]] of the line.

Of course you will now always need to remember to either add this back in after upgrading versions of WordPress, or keep a copy of this file and just merge it into things afterward (and make sure any updates didn’t affect this file).

The one thing that is unfortunate is I was hoping to be able to add some stuff to my plugins for this for anyone to benefit, but can’t. Oh well.

AWSOM Powered