WordPress Custom RSS feeds

Wordpress Logo

Adding custom content to your RSS feed is actually a fairly simple process. You may wish to do this to add a copyright notice, a link to social media profile, twitter account, or perhaps even sell advertising.
Basic usage looks like this:

function rssModification ($contentToFilter) {
// Manipulate the content as required
return $contentToFilter;
}add_filter('filterName', 'rssModification ');

There are lots of filters available and obviously an extensive list here. In this example we are going to use the the_excerpt_rss and the_content_rss filters.

When the filter is executed the data to be modified is passed to the specified function. The content can then be altered and then returned.


function rssContent($content) {
$content = $content . '<a href="http://twitter.com/booleanvalue/">Follow me on Twitter!</a>';
return $content;
}
add_filter('the_excerpt_rss', 'rssContent');
add_filter('the_content_rss', 'rssContent');

2 thoughts on “WordPress Custom RSS feeds”

  1. Thanks for this, – I have used it to add a copyright notice to my feed.

    That was something I wasn’t looking forward to doing, so you’ve saved me a lot of time in that respect.

    Any other resources similar to this planned?

  2. Cant say I had anything planned on WordPress / RSS; however I’ll keep it in mind for when I dont have a topic pertaining to a particular issue that I am working on. (Which is usually the case with my posts)

    There is a small amount of RSS related code for removing categories from your feed in this post

    Thanks for the feedback.

Leave a Reply

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