Trying to exclude posts from a category on the home page
Technically, pre_get_posts is an action, not a filter, and you don’t need to return anything and $query is passed in by reference, but that code should nonetheless work. Cleaned up it would be: function excludeCat($query) { if ( $query->is_home ) { $catid = get_cat_ID(‘watch-isatv’); $query->set(‘cat’, ‘-‘.$catid); } } add_action(‘pre_get_posts’, ‘excludeCat’); There are several potential points … Read more