Easy Ways to Exclude Some Categories in WordPress RSS Feed
Do you want to exclude posts from some categories in your wordpress RSS feed? In this page I will show you how to make it in a easy way. First you have to know the ID of the category which you want to exclude. Once you have the category ID, paste the following codes into your functions.php file:
function rss_exclude($query) { if ($query->is_feed) { $query->set('cat','-5,-6'); // simply add a dash “-” followed by the category ID that you want to exclude. } return $query; } add_filter('pre_get_posts','rss_exclude ');
Once you saved it and uploaded the file, those posts from the categories will be excluded from your RSS feed.
Note: using url like the following line will also achieve the goal. (i.e. exclude category 3 and 12)
http://yourdomain.com/rss&cat=-3&cat=-12