bradgrier.com

Byte-Sized Technology In Easy-to-Understand Language

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

Which would render thusly:

My WordPress tag feed hosted on Feedburner.

Written by bgrier

June 23, 2008 at 11:47 am

Posted in Blogging, How to, Social Media

Tagged with , , , , , , , , ,

6 Responses

Subscribe to comments with RSS.

  1. 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. 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 :)

    Brad Grier

    July 10, 2008 at 8:11 am

  3. 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

    Adieska

    August 13, 2008 at 10:19 am

  4. @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

    bgrier

    August 13, 2008 at 10:54 am

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

    Anthony

    October 23, 2008 at 6:44 am

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

    Brad Grier

    October 23, 2008 at 8:15 am


Comments are closed.