Created
January 2, 2018 02:56
-
-
Save merill/92c71ffc980a1741ba1c4cc6900a3e5c to your computer and use it in GitHub Desktop.
WordPress Micro Blog gist to hide a specific category from the default feed
This file contains 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
/* Hide posts with the 'status' category from the default RSS feed but allow them to show in the site specific feed */ | |
function exclude_category($query) { | |
if ( $query->is_feed ) { | |
if (is_category()) {} | |
else { | |
$query->set('cat', '-154'); | |
} | |
} | |
return $query; | |
} | |
add_filter('pre_get_posts', 'exclude_category'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment