is_post_type_hierarchical

函数
is_post_type_hierarchical ( $post_type )
参数
  • (string) $post_type Post type name
    Required:
返回值
  • (bool) Whether post type is hierarchical.
相关
  • get_post_type_object()
定义位置
相关方法
is_post_type_archiveis_post_type_viewableis_taxonomy_hierarchicalget_post_type_archive_linkpost_type_archive_title
引入
3.0.0
弃用
-

is_post_type_hierarchical – 这个函数检查一个给定的文章类型是否是分层的。如果文章类型是分层的,它返回true,否则返回false。

确定文章类型是否是分层的。

一个错误的返回值也可能意味着该文章类型不存在。

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;
}

常见问题

FAQs
查看更多 >
闪电侠

(工作日 10:00 - 18:30 为您服务)

2025-12-05 19:32:59

您好,无论是售前、售后、意见建议……均可通过联系工单与我们取得联系。

您也可选择聊天工具与我们即时沟通或点击查看:

您的工单我们已经收到,我们将会尽快跟您联系!
取消
选择聊天工具: