get_post_type()
最后更新于:2021-11-26 22:43:10
get_post_type( int|GC_Post|null$post=null)Retrieves the post type of the current post or of a given post.
参数
- $post
-
(int|GC_Post|null) (Optional) Post ID or post object. Default is global $post.
Default value: null
响应
(string|false) Post type on success, false on failure.
源文件
文件: gc-includes/post.php
function get_post_type( $post = null ) {
$post = get_post( $post );
if ( $post ) {
return $post->post_type;
}
return false;
}