is_post_type_viewable()
最后更新于:2021-11-27 10:18:33
is_post_type_viewable( string|GC_Post_Type$post_type)Determines whether a post type is considered “viewable”.
参数
- $post_type
-
(string|GC_Post_Type) (Required) Post type name or object.
响应
(bool) Whether the post type should be considered viewable.
源文件
文件: gc-includes/post.php
function is_post_type_viewable( $post_type ) {
if ( is_scalar( $post_type ) ) {
$post_type = get_post_type_object( $post_type );
if ( ! $post_type ) {
return false;
}
}
if ( ! is_object( $post_type ) ) {
return false;
}
return $post_type->publicly_queryable || ( $post_type->_builtin && $post_type->public );
}