Tweaking your FeedBurner / FeedSmith plugin to support WordPress 2.5+ tag feeds (easy!)

FeedBurner Logo (© FeedBurner, Inc.)
Creative Commons License photo credit: magbag

Sorry for the uber tech in this post, but I thought this was a simple fix that anyone running a WordPress 2.5+ blog could do if they wanted to enable ‘Tag Feeds’.

Before I get into the how, let’s explore the why briefly.

Some background:

  • Feedburner is the service I (and many many other) bloggers use to improve RSS Feed performance and measure readership of our RSS feeds.
  • The FeedSmith / FeedBurner plugin is a component for WordPress (the blogging platform I use here) that simplifies the administration and implementation of Feedburner.

The current incarnation of the FeedSmith / FeedBurner plugin doesn’t support the new WordPress feature of RSS Tag Feeds. No big deal if you don’t care about allowing your visitors to subscribe to your content based on Tag. But you’re missing an opportunity to allow your readers to better filter the content if that’s the case.

For example, lets say a visitor is only interested in receiving my posts on photography. They don’t care about all this technology, web content, usability, or search engine optimization that I may be writing about. They only care about my photography posts. WordPress 2.5+ allows you to subscribe to any Tag Feed or Category Feed. But not if you’re using an unmodified FeedSmith plugin. Fear not, I’ve got a fix for you in a moment.

The way the current FeedSmith plugin works is that it takes all my feed subscription requests (comment, category, tag, etc) and returns only the main blog RSS feed, which is the main feed at Feedburner. Not good if you want to have an RSS Feed of only my photography tagged posts.

The workaround is quite simple and requires slightly modifying your FeedBurner / FeedSmith plugin. Here’s how:

  1. Navigate to the main Plugins page. Scroll down until you find the Feedburner / FeedSmith plugin. Click on the Disable link in the right-hand column. When the page refreshes, scroll back down and click on the Edit link.
  2. The Plugin Editor screen will open. Scroll down in the edit window until you find the function function ol_feed_redirect()
  3. In that section you’ll be adding text to a line of code. Change the text that reads
    is_feed() && $feed != 'comments-rss2' && !is_single() &&
    to read
    is_feed() && $feed != 'comments-rss2' && !is_single() && !is_tag() &&
  4. Scroll to the bottom of the page and press the Update File button.
  5. Then, go back to the main Plugins page, and re-enable the FeedBurner / FeedSmith plugin by clicking on the Enable link.

Congratulations, you’ve just re-enabled Tag RSS Feeds for your WordPress 2.5+ blog whilst maintaining Feedburner compatibility for the main feed.

Bonus for the advanced student: Since your Tag RSS Feeds are now separated from the main blog feed, you can set up discreet Feedburner feeds for select tags. Unfortunately the little hack above won’t automagically redirect RSS Subscriptions to Feedburner for you, as the FeedSmith Plugin does. You’ll have to manually publish the Feed URL, thusly:
<a href="">My WordPress tag feed hosted on Feedburner</a>

Which would render thusly:

My WordPress tag feed hosted on Feedburner.