post_type_exists()

You are here:

post_type_exists( string $post_type )

Determines whether a post type is registered.

Description Description

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

See also See also

  • get_post_type_object()

Top ↑

Parameters Parameters

$post_type

(string) (Required) Post type name.


Top ↑

Return Return

(bool) Whether post type is registered.


Top ↑

Source Source

File: wp-includes/post.php

1206
1207
1208
function post_type_exists( $post_type ) {
    return (bool) get_post_type_object( $post_type );
}


Top ↑

Changelog Changelog

Changelog
Version Description
3.0.0 Introduced.
Was this article helpful?
Dislike 0
Views: 10