WordPress exclude specific category from blog page
function exclude_category( $query ) {
if ( $query->is_home() && $query->is_main_query() ) {
$query->set( 'cat', '-126' );
}
}
add_action( 'pre_get_posts', 'exclude_category' );
Here, 126 is category id and minus sign tells to exclude.