How to exclude a category from RSS Feed in WordPress

If you want to exclude a category from your RSS Feed in your WordPress powered blog, you can do that easily. Only thing you need is to add these lines to the functions.php in your current theme. If your theme doesn’t have a functions.php, just make one, and it will work.

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

You have to change “15” with the category ID you want to exclude. Please note that these lines must be between PHP tags.

İbrahim

Hekim. Yazar, beğenirse çevirir, kod yazarak eğlenir. 2002'den beri internette yazıyor.