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 with Thumbnails
Like this? Share it please!
  • Twitter
  • Digg
  • Facebook
  • RSS
  • Suggest to Techmeme via Twitter
  • del.icio.us
  • LinkedIn
  • Posterous
  • Reddit
  • StumbleUpon

Related posts:

  1. How to automatically post your Facebook status to Twitter
  2. How to synchronize your podcast feeds on many computers
  3. Keep your RSS feeds under control with Google Reader
  4. Reading RSS Feeds — then you need Feedreader
  5. Listen to me. How to convert your blog post into a podcast.


{ 2 trackbacks }

How I set up a feed based on Wordpress tags using Feedburner : Heather on her travels
March 31, 2009 at 3:37 pm
Addicted to feeds | ../learninglab/joss
February 24, 2010 at 5:33 am

{ 13 comments… read them below or add one }

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

Hi Brad,

Stumbled across your site on a ques­tion to hack the Feed­Smith plu­gin to work with cat­egory feeds. Your explan­a­tion of alter­ing it to work with tag feeds is so beau­ti­fully clear and con­cise, I won­der if you wouldn’t mind doing the same for cats!

Thanks …

Richard Miller (Sparkletack)s last blog post..SFWeekly: “Non­con­form­ity Still Reigns”

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

Ha!

Hi Richard, thanks, your com­ment made me blow cof­fee out my nose *clean­ing the com­puter screen*…

Cats, no, I have no wish to doc­u­ment cat alter­ing at this time. Though there are some cell­phone wield­ing 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 won­der­ing if you can make a feed also for the cat­egory. Same ques­tion as Richard Miller :)

Adieskas last blog post..Kenny Ches­ney: CMA 2008 Enter­tainer of the Year

4 bgrier August 13, 2008 at 10:54 am

@Adieska — Good ques­tion. (Sorry @Richard, I mis­read your com­ment to mean you’d like me to alter felines, not cat­egor­ies) :)

Though I’ve not tried it, I ima­gine that if you take the fol­low­ing 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 set­ting up the cus­tom feed­burner feed for any cat­egor­ies 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 look­ing for!

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

@Anthony — My pleas­ure 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 exten­ded 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 post­ing that extension!

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

Friend­Feed Com­ment


Tw… [link to post]

— Pos­ted using Chat Catcher

10 Missingtoof January 24, 2010 at 6:24 pm

Thanks for the tip. I went a step farther strip­ping out all the Feed URIs that Word­press inserts into the head of the doc­u­ment (for the RSS but­ton in/by the address bar). These fil­ters grab onto things in link-template.php (in word­press 2.9.*) and your theme’s functions.php file.

func­tion remove_rss() {
return;
}
add_filter(‘post_comments_feed_link’,‘remove_rss’);
add_filter(‘category_feed_link’,‘remove_rss’);
add_filter(‘author_feed_link’,‘remove_rss’);
add_filter(‘search_feed_link’,‘remove_rss’);

Then we can go in to header.php and add just the URIs of the newly cre­ated Feed­burner feeds to the manu­ally. Such as this:

Hope that helps some­body (you’ve got the top res­ult on my Google search query, so it’s likely other people are com­ing here too)

11 Missingtoof January 24, 2010 at 6:25 pm

The XHTML was parsed out above. This would go in the <head>

<link rel=“alternate” type=“application/atom+xml” title=“Missingtoof.com » Full RSS Feed (All Posts)” href=“http://feeds.missingtoof.com/missingtoof” />

12 Missingtoof January 24, 2010 at 6:31 pm

…damn, with your own title and URI, of course.

13 Brad Grier January 24, 2010 at 8:48 pm

Heh, nice work Miss­ing­toof! And thanks for tak­ing the time to share it, I’m sure someone will appre­ci­ate it, as you said, this thread is being searched and found.

Cheers!

–Brad

Leave a Comment

Thesis Theme for WordPress:  Options Galore and a Helpful Support Community
Creative Commons License
blog.bradgrier.com by Brad Grier is licensed under a
Creative Commons Attribution-Noncommercial-Share Alike 2.5 Canada License.
Based on a work at blog.bradgrier.com.
Get Adobe Flash playerPlugin by wpburn.com wordpress themes
ss_blog_claim=44aa26329ed37448560e7d4275ad1ef0