Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Exclude posts of specific categories from WordPress RSS feed. Source: http://www.jangro.com/excluding-posts-from-your-blog-feed/
<?php
//* Exclude posts of specific categories from RSS feed
function customprefix_exclude_categories_rss_feed($query) {
if ($query->is_feed) {
$query->set('cat', '-5, -11, -18'); // Precede category IDs with a minus sign
}
return $query;
}
add_filter('pre_get_posts', 'customprefix_exclude_categories_rss_feed');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.