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.

Return

true/false. Whether post type is registered.

Usage

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

<?php
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