Exclude categories from RSS feed with functions.php

Adding this snippet to the functions.php of your wordpress theme will exclude specified categories from RSS feed.

 

 

function exclude_cat_wps($query) {
if ($query->is_feed) {
$query->set('cat','-20,-21,-22');
}
return $query;
}
add_filter('pre_get_posts','exclude_cat_wps');

Be Sociable, Share!

Leave a comment