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

by Brad Grier on June 23, 2008

in Blogging, How to, Social Media

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="http://feeds.feedburner.com/BlogbradgriercomWordpress">My Wordpress tag feed hosted on Feedburner</a>

Which would render thusly:

My Wordpress tag feed hosted on Feedburner.


Related posts:

  1. How to synchronize your podcast feeds on many computers Hello ther
  2. Wordpress 2.6 is out — and you’re using it now. Hello ther
  3. Simple update adds iPhone style to your blog Hello ther
  4. In Transition — as the page says Hello ther


{ 1 trackback }

How I set up a feed based on Wordpress tags using Feedburner : Heather on her travels
March 31, 2009 at 3:37 pm

{ 9 comments }

1 Richard Miller (Sparkletack) July 10, 2008 at 1:10 am

Hi Brad,

Stumbled across your site on a question to hack the FeedSmith plugin to work with category feeds. Your explanation of altering it to work with tag feeds is so beautifully clear and concise, I wonder if you wouldn’t mind doing the same for cats!

Thanks …

Richard Miller (Sparkletack)s last blog post..SFWeekly: “Nonconformity Still Reigns”

2 Brad Grier July 10, 2008 at 8:11 am

Ha!

Hi Richard, thanks, your comment made me blow coffee out my nose *cleaning the computer screen*…

Cats, no, I have no wish to document cat altering at this time. Though there are some cellphone wielding drivers I’d like to alter :)

3 Adieska August 13, 2008 at 10:19 am

Wow… Thanks for this tutorial. This is help us so much. I also wondering if you can make a feed also for the category. Same question as Richard Miller :)

Adieskas last blog post..Kenny Chesney: CMA 2008 Entertainer of the Year

4 bgrier August 13, 2008 at 10:54 am

@Adieska – Good question. (Sorry @Richard, I misread your comment to mean you’d like me to alter felines, not categories) :)

Though I’ve not tried it, I imagine that if you take the following text:
is_feed() && $feed != 'comments-rss2' && !is_single() &&
to read
is_feed() && $feed != 'comments-rss2' && !is_single() && !is_tag() &&

and change the last line to read:
is_feed() && $feed != 'comments-rss2' && !is_single() && !is_tag() && !is_category() &&

it ‘may’ work.

Then you’d have to go through the same hoops of setting up the custom feedburner feed for any categories you’d like to feed.

Again, not tested, so your mileage may vary.

– Brad

5 Anthony October 23, 2008 at 6:44 am

Thanks for your help, this was exactly what I was looking for!

6 Brad Grier October 23, 2008 at 8:15 am

@Anthony – My pleasure Anthony. Always happy to help :)

7 Chad A. Johnson December 11, 2008 at 3:16 pm

Great post. This was exactly what I needed.

I extended the code to include author feeds like this:

is_feed() && $feed != ‘comments-rss2′ && !is_single() && !is_tag() && !is_author() &&

8 Brad Grier December 11, 2008 at 10:01 pm

@Chad, good call, thanks for posting that extension!

9 realsurf (mrRealSurf) February 9, 2009 at 7:05 pm

FriendFeed Comment


Tw… [link to post]

– Posted using Chat Catcher

Comments on this entry are closed.