get_the_term_list without specific category

I believe that what you want is to exclude a term. It is odd that such is not an option with that function but you can use a filter on get_the_terms:

function exclude_my_term($terms, $post, $taxonomy) {
  remove_filter('get_the_terms','exclude_my_term',10,3);
  unset($terms[123]); // where 123 is the ID of the term to exclude
  return $terms;
}
add_filter('get_the_terms','exclude_my_term',10,3);

You probably want to run that just before your call to get_the_term_list().

Leave a Comment