WordPress at Your Fingertips

is_taxonomy_hierarchical() WP 1.0

Whether the taxonomy object is hierarchical.

Checks to make sure that the taxonomy is an object first. Then Gets the object, and finally returns the hierarchical value in the object.

A false return value might also mean that the taxonomy does not exist.

For more information on this and similar theme functions, check out the Conditional Tags article in the Theme Developer Handbook.

1 time — 0.000011 sec (very fast) | 50000 times — 0.02 sec (speed of light) | PHP 7.0.8, WP 4.6.1

No Hooks.

Return

true|false. Whether the taxonomy is hierarchical.

Usage

is_taxonomy_hierarchical( $taxonomy );
$taxonomy(string) (required)
Name of taxonomy object.

Changelog

Since 2.3.0 Introduced.

Code of is_taxonomy_hierarchical() WP 5.8.1

function is_taxonomy_hierarchical( $taxonomy ) {
	if ( ! taxonomy_exists( $taxonomy ) ) {
		return false;
	}

	$taxonomy = get_taxonomy( $taxonomy );
	return $taxonomy->hierarchical;
}

Conditional tags (all)

Any taxonomy

No comments
    Log In