I created a new Hook called Hide Uncategorized Posts in Blogroll. Uncategorized category ID=1. It has the following code:
<?php
add_filter('pre_get_posts', 'excludeCat');
function excludeCat($query) {
if ( $query->is_home ) {
$query->set('cat', '-1');
}
return $query;
}
?>
The hook is set to generate_before_header and Execute PHP is checked. The location is set to Blog.
I have a blog called Summer Camps Dublin OH that has the Uncategorized category in it, and it still shows in the Blogroll. Any ideas what I’m missing?
https://www.classroomantics.com/blog/