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



post_type_exists ›

Since3.0.0
已弃用n/a
post_type_exists ( $post_type )
参数:
  • (string) $post_type Post type name.
    Required: Yes
查看:
返回:
  • (bool) Whether post type is registered.
定义在:
文档:

Determines whether a post type is registered.

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 post_type_exists( $post_type ) {
	return (bool) get_post_type_object( $post_type );
}