WordPress version: 3.1
I need to exclude one category from Feed, so I add the following function to the functions.php file. However, it doesn’t work. How to fix it?
function ExcludeCategory($query) {
if ($query->is_feed) {
$query->set('cat','-1716');
}
return $query;
}
add_filter('pre_get_posts','ExcludeCategory');
this’ll work:
seems to be a problem with or change in in 3.1:
http://themehybrid.com/support/topic/exclude-category-from-archive-with-pre_get_posts#post-56892
http://wordpress.org/support/topic/query_posts-no-longer-working-in-31
I am not sure if you are referring to the blog home page. If that’s the case then you probably need to replace ‘feed’ with ‘home’. Otherwise, the code seems fine.
Change your feed structure.
E.g.
You might need to change this in FeedBurner too.