Copy the snippet below in your functions.php file. Replace the category IDs on line 3 with the ones you want to exclude. Then save the file and you’re done.
function exclude_category_home( $query ) { if ( $query->is_home ) { $query->set( 'cat', '-5, -34' ); } return $query; } add_filter( 'pre_get_posts', 'exclude_category_home' );
Thanks to WP Mayor for the code snippet!