1$term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
2echo $term->name; // will show the name
3echo $term->slug; // will show the slug
1You need to pass an additional argument to get_terms(). The default is to hide
2"empty" terms-- terms which are assigned to no posts.
3
4$terms = get_terms([
5 'taxonomy' => $taxonomy,
6 'hide_empty' => false,
7]);