post_type_exists() – Determines whether a post type is registered.

You appear to be a bot. Output may be restricted

Description

Determines whether a post type is registered.

For more information on this and similar theme functions, check out the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ Conditional Tags} article in the Theme Developer Handbook.

Usage

$bool = post_type_exists( $post_type );

Parameters

$post_type
( string ) required – Post type name.

Returns

bool Whether post type is registered.

Source

File name: wordpress/wp-includes/post.php
Lines:

1 to 3 of 3
function post_type_exists( $post_type ) {
  return (bool) get_post_type_object( $post_type );
}
 

 View on GitHub View on Trac