WordPress: remove category posts from RSS feed

Want to say thanks to jangro.com for having a WordPress function to block a specific WordPress category from appearing in my RSS feed. I just added this to my theme’s function.php file and changed the category number to the number of the category to omit and voila, the RSS feed is now free of the other category.

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

About Bruce

Comments

2 Responses to “WordPress: remove category posts from RSS feed”
  1. admin says:

    Thanks Mike!

    I fixed the code per your find. I appreciate the heads up!!!!

Trackbacks

Check out what others are saying about this post...
  1. [...] we didn’t want them in the rss feed.After hunting around for a bit, I came across this from Ash Point Lane. The code is slightly different from Bruce’s because his seems to have corrupted slightly [...]



Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!

You must be logged in to post a comment.