WordPress函数is_post_type_hierarchical()判断自定义文章类型在注册的时候是否设置了支持分类页面

描述:

判断自定义文章类型在注册的时候是否设置了支持分类页面

用法:

<?php is_post_type_hierarchical( $post_type) ?>

参数:

$post_type

(string) (必填) 自定义文章类型的name

默认值: None

源文件:

/**
 * Whether the post type is hierarchical.
 *
 * A false return value might also mean that the post type does not exist.
 *
 * @since 3.0.0
 *
 * @see get_post_type_object()
 *
 * @param string $post_type Post type name
 * @return bool Whether post type is hierarchical.
 */
function is_post_type_hierarchical( $post_type ) {
	if ( ! post_type_exists( $post_type ) )
		return false;

	$post_type = get_post_type_object( $post_type );
	return $post_type->hierarchical;
}