WordPress开发者和主题制作者的搜索引擎



is_taxonomy_hierarchical ›

Since2.3.0
已弃用n/a
is_taxonomy_hierarchical ( $taxonomy )
参数:
  • (string) $taxonomy Name of taxonomy object.
    Required: Yes
返回:
  • (bool) Whether the taxonomy is hierarchical.
定义在:
文档:

Determines 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 {@link https://developer.wordpress.org/themes/basics/conditional-tags/ Conditional Tags} article in the Theme Developer Handbook.



源码

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

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