WebDev
Category: Wordpress
Exclude a Category from your RSS Feed in WordPress
Posted on September 21, 2010, at 10:35 pm

Thanks to my friend Andrew (a la Scurvy Design), I discovered this morning a flaw in the way my “On the Go” post images were displaying in Google Reader. They were blowing way out of the window size and it looked horrible. So I opted to find a way to remove those posts from my feed.

A little bit of research found a method to add a filter to your RSS feed:

function feedFilter($query) {
  if ($query->is_feed) {
    $query->set('cat', '-375');
  }
  return $query;
}
add_filter('pre_get_posts','feedFilter');

The “375″ is the numerical ID of the category you want to exclude. You can exclude multiple categories by separating them with commas, i.e. set(‘cat’, ‘-375,-3,-8′).

This code needs to be placed in your “functions.php” file.

It’s a bit annoying that Google reader caches everything it sees. What do you do when you have test posts make make their way into the cache? Though ultimately, I think it’s a good thing. If a well-known villain were to post something awful, and it were to get picked up by Google reader, it would be that much harder to hide.

More Updates...
  • Postnatal care in France. Interesting!
  • The Snuggle Sutra For Valentine’s day.
  • Movie Posters re-imagined in another time.
  • Pepper's too pushy! Nominating a new consort for Salt…
  • Was Marilyn Monroe fat? Simon Doonan reveals what he discovered when rifling through the icon’s belongings.
  • Bill Hicks would have turned 50 recently.
  • Ross Douthat, Gravedigger
  • Slate's Announcement of Christopher Hitchens’ passing.
  • See more...
    Blair Kelly
    I'm a skeptic, freethinker, and secular humanist.

    After a year as a content developer at a successful IT company, I'm taking some time to regroup and set a new course.

    I hold a combined honours degree in communications studies and multimedia from McMaster University.