Look at the docs (please read the docs) for is_taxonomy_hierarchical()
. You need to tell it which taxonomy you’re checking:
if ( is_taxonomy_hierarchical( 'my_taxonomy_name' ) ) {
}
If you’re template isn’t specific to a taxonomy, and you need to know which taxonomy you’re viewing, use get_queried_object()
to figure it out (you were already told how to do this, by the way):
if ( is_tax() ) {
$taxonomy = get_queried_object()->taxonomy;
if ( is_taxonomy_hierarchical( $taxonomy ) ) {
} else {
}
}