Tag: categories

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

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!