All Posts Tagged Tags   

Wordpress and FeedBurner FeedSmith: Getting to your category and tag feeds

July 29th, 2008

Last time I touched on Wordpress and Feedburner, the topic was how to tweak the Feedsmith plug-in so you could get access to your raw feed with Yahoo! Pipes. This time, I’m making some alterations to the plug-in so you gain access to your raw category and tag related feeds without those requests getting redirected back to your blog’s main Feedburner feed.

For most folks using the Feedburner redirect plug-in, getting access to Wordpress’s category and tag feeds seems like a nightmare. I searched and searched myself, and all I found was numerous iterations of .htaccess file solutions. None of them worked for me, so I decided to go back to the Feedburner_FeedSmith_Plugin.php file and tool around. This turned out to be a quick fix, with one caveat - I don’t care to burn additional feeds for each of my categories, and this change won’t work for you if that’s your intention. In my case the blog categories are organized by “origin” of the post, not subject matter - what I really wanted was access to the tag feeds, which do relate to the subject of the post at hand. Here’s how to do it…

First, look to the bottom of the Feedsmith plug-in file (located under /wp-content/plugins/feedburner_feedsmith_plugin_2.2) for this:

if (!preg_match("/feedburner|feedvalidator/i", $_SERVER['HTTP_USER_AGENT'])) {
add_action(’template_redirect’, ‘ol_feed_redirect’);
add_action(’init’,'ol_check_url’);
}

That “!preg_match” bit tells Wordpress to ignore redirect requests from Feedburner or FeedValidator so those services don’t wind up in an endless loop when trying to grab your raw feed. And it’s this same section of the plug-in code that pushes requests for category and tag feeds back to Feedburner for so many agitated users. We change that block of code to this (changes emphasized):

if (!preg_match("/feedburner|feedvalidator/i", $_SERVER['HTTP_USER_AGENT']) && !preg_match(”/category|tag/i”, $_SERVER['REQUEST_URI'])) {
add_action(’template_redirect’, ‘ol_feed_redirect’);
add_action(’init’,'ol_check_url’);
}

That additional “!preg_match” string tells Wordpress to ignore redirects to Feedburner when the requested URL contains “category” or “tag”, but there is still one more thing you’ve got to do. In this blog’s case, my category base is “origin” - so in place of “category” I use the word “origin”; I still use “tag” for my tag base, so that stays the same. You set your category and tag bases in the Wordpress admin panel under Settings..Permalinks - look for this:

Wordpress Optional Permalink Controls

If your optional permalinks are set, change the code snippet above to reflect the same (/’s excluded) and save - otherwise set them as desired first then do the same. Now you should have raw category and tag feeds that work.

Two of the most popular tags on this blog are “Fly Fishing” and “Fannie Mae” - and here are their feeds:

  • Fly Fishing
  • Fannie Mae
  • Try it for yourself!

    Good Content versus Tricked Distribution

    May 15th, 2005

    A colleague and I have been running a jointed, intermittent conversation on the merits of good content. He spends a lot of time expounding on the issues of poor or untruthful press coverage, the sheer enormity of blogs out there, and questions why nobody has done it quite right. I have to agree - Thoughtmarket smells a bit putrid at times, but at least I know it.

    Then, early last week he directed me to Remove Forebrain and Serve: Tag Clouds II, from Jeffrey Zeldman, and it struck a cord.
    Read more »