Skip to content

Instantly share code, notes, and snippets.

@braddalton
Last active December 14, 2015 18:09
Show Gist options
  • Save braddalton/5127663 to your computer and use it in GitHub Desktop.
Save braddalton/5127663 to your computer and use it in GitHub Desktop.
Add one or more category i.d's to this code which will exclude all posts assigned to that category from displaying in your RSS feed. http://wpsites.net/wordpress-tips/exclude-categories-rss-feed/
function wpsites_exclude_category_feed($query) {
if ($query->is_feed) {
$query->set('cat','-007');
}
return $query;
}
/**
* @author Brad Dalton
* @example http://wpsites.net/
* @copyright 2014 WP Sites
*/
add_filter('pre_get_posts','wpsites_exclude_category_feed');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment