Exclude category from RSS in Wordpress

function myFeedExcluder($query) { if ($query->is_feed) { $query->set('cat','-12'); } return $query; } add_filter('pre_get_posts','myFeedExcluder');
How to exclude a category from the standard RSS-feed in Wordpress. Add this snippet in the themes function.php-file.

Add more categories by adding IDs. Ex: -12,-13,-14

1 Response

Very useful for posting sponsored reviews or press releases which is not useful for subscribed readers.

Write a comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.