post_type_exists

函数


post_type_exists ( $post_type )
参数
  • (string)
    $post_type
    Post type name.
    Required:
返回值
  • (bool) Whether post type is registered.
相关
  • get_post_type_object()
定义位置
  • wp-includes/post.php
    , line 1454
引入
3.0.0
弃用

确定一个文章类型是否被注册。

关于这个和类似主题函数的更多信息,请查看《主题开发者手册》中的{@link Conditional Tags}文章。

function post_type_exists( $post_type ) {
	return (bool) get_post_type_object( $post_type );
}