Exclude Categories from your RSS Feed in WordPress
by Bandicoot Marketing on | Posted in Tutorials | 11 comments
I had someone ask me how to do this the other day and I didn’t know how. But after reading through some of the WordPress Codex I was able to figure it out. To exclude specific categories from your RSS feed just add the following code snippet to your theme’s functions.php file.
function myFeedExcluder($query) { if ($query->is_feed) { $query->set('cat','-12'); } return $query; } add_filter('pre_get_posts','myFeedExcluder');
As always, make sure it is between PHP tags. And if the theme you are using does not have a functions.php file, just create on yourself and add the above code snippet after an opening PHP tag.
11 comments for “Exclude Categories from your RSS Feed in WordPress”