函数原型
post_type_exists( string $post_type ): bool
函数描述
Determines whether a post type is registered.
是否弃用
未弃用
函数参数
-
$post_type
string
Required - Post type name.
函数返回值
bool Whether post type is registered.
函数位置
File: wp-includes/post.php.
函数源码
function post_type_exists( $post_type ) {
return (bool) get_post_type_object( $post_type );
}
源码链接
变更日志
| Version | Description |
|---|---|
| 3.0.0 | Introduced. |

