Created
April 27, 2016 19:33
-
-
Save CaroManel/79619c87c36519f5564c255458adbf0e to your computer and use it in GitHub Desktop.
Remove uncategorized post from RSS 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
add_filter('pre_get_posts','exclude_category'); | |
//exclude uncategorized category from rss | |
function exclude_category($query) { | |
if ( $query->is_feed ) { | |
$category_id = -1 * get_cat_ID('Uncategorized'); | |
$query->set('cat', $category_id); | |
} | |
return $query; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment