get_post_type( int|WP_Post|null $post = null )
Retrieves the post type of the current post or of a given post.
Parameters Parameters
- $post
- 
(int|WP_Post|null) (Optional) Post ID or post object. Default is global $post. Default value: null 
Return Return
(string|false) Post type on success, false on failure.
Source Source
File: wp-includes/post.php
| 1218 1219 1220 1221 1222 1223 1224 1225 | functionget_post_type( $post= null ) {    $post= get_post( $post);    if( $post) {        return$post->post_type;    }    returnfalse;} | 
View on Trac
Changelog Changelog
| Version | Description | 
|---|---|
| 2.1.0 | Introduced. | 
