Snippets: Exclude Terms from Categories Meta

add_filter( 'wp_get_object_terms', function( $terms ) {
	if ( $terms ) {
		$excluded_terms = array( 100, 40 ); // array of term ID's to exclude
		foreach( $terms as $key => $term ) {
			if ( in_array( $term->term_id, $excluded_terms ) ) {
				unset($terms[$key]);
			}
		}
	}
	return $terms;
}, 10, 3 );
All PHP snippets should be added via a child theme's functions.php file.