WordPress at a glance

post_type_exists() WP 1.0

Check if a post type is registered.

For more information on this and similar theme functions, check out the Conditional Tags article in the Theme Developer Handbook.

  • 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 WP 5.2.2

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