In your theme’s functions.php file, you can add the following code, replacing in the third line the category IDs you want to exclude. In this example, I exclude the categories with ID numbers 2 and 3.
function exclude_category_home( $query ) {
if ( $query->is_home ) {
$query->set( 'cat', '-2, -3' );
}
return $query;
}
add_filter( 'pre_get_posts', 'exclude_category_home' );
If you don’t want to edit your theme’s functions.php file, you can create your own plugin, or if you have already created, simply throw in the code shown.
Another solution, maybe this plugin solves your need Ultimate category excluder.
Regards
-
This reply was modified 8 years, 1 month ago by Gabri Gonzalez. Reason: Add a related plugin