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



get_post_type › WordPress Function

Since2.1.0
已弃用n/a
get_post_type ( $post = null )
参数:
  • (int|WP_Post|null) $post Optional. Post ID or post object. Default is global $post.
    Required: No
    默认: null
返回:
  • (string|false) Post type on success, false on failure.
定义在:
文档:

Retrieves the post type of the current post or of a given post.



源码

function get_post_type( $post = null ) {
	$post = get_post( $post );
	if ( $post ) {
		return $post->post_type;
	}

	return false;
}