WordPress at a glance

post_type_exists() WP 1.0

Check if a post type is registered.

  • See: get_post_type_object()
Works based on: get_post_type_object()
✈ 1 time = 0.000018s = very fast | 50000 times = 0.03s = speed of light

No Hooks.


true/false. Whether post type is registered.


post_type_exists( $post_type );
$post_type(string) (required)
Post type name.

Code of post_type_exists: wp-includes/post.php VER 4.9.8

function post_type_exists( $post_type ) {
	return (bool) get_post_type_object( $post_type );

Related Functions

From tag: Custom post type (post_type)

More from category: Custom Types

No comments
    Hello, !     Log In . Register