Last active
December 14, 2015 18:09
-
-
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/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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