That doesn’t work either. I found that the category number assigned to the Events category was 6, so I tried this:
function exclude_category($query) {
if ( $query->is_home || $query->is_blog ) {$query->set(‘cat’, ‘6’);}
return $query;}
add_filter(‘pre_get_posts’, ‘exclude_category’);
…but that didn’t work either. Anybody else?
I added this in the functions.php file of my wordpress theme folder, replacing ‘-1’ with ‘Events’ for the name of the category I am trying to exclude. It’s not working. Maybe I can’t replace the number with a category name? What am I doing wrong?
Thanks.