Modifying WordPress RSS Feed

Changing the WordPress RSS is one of the most arduous tasks ever … unless you know how to use hooks.

Hooks are basically functions that do something to an existing process.

Think about it this way, if you were making a cup of coffee, a hook would be sugar that makes a bitter tasting beverage sweet!

The problem: we needed to add a thumbnail to an RSS feed without modifying the wordpress core files.

The solution: create a hook, that modifies the content of each RSS post, before the feed published, and adds in a thumbnail, without affecting the actual post itself.

Here is a zip file containing 2 functions and the hook; fully commented: wpRssEdit.zip

Simply copy and paste this into your theme’s functions.php and it will start working as soon as you update a post or add a new post!

If you want to modify what is added to your RSS feed (say you don’t want a thumbnail, you just want to add a piece of text), just change what the feedContentFilter() does :]

If you need any help, leave a comment ;]

Leave a Reply

Your email address will not be published. Required fields are marked *