I needed a way to exclude certain posts from my RSS feed. I wanted to be able to just choose a category like No-Feeds and know this post wasn’t going to show up in someone’s news reader.
After a little Google digging I found this article, Top 5 Ways to Exclude Posts from Your WordPress RSS Feed.
Number #2 seems to work best for me. I just edited my theme’s function.php file and added the following code. Problem solved!
// This excludes category 25 (no-feed) from RSS/feedburner
function myFilter($query) {
if ($query->is_home || $query->is_feed) {
$query->set('cat','-25');
}
return $query;
}
add_filter('pre_get_posts','myFilter');
Recent Posts