post_type_exists

The timeline below displays how wordpress function post_type_exists has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 5.1

/**
 * 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.
 *
 * @since 3.0.0
 *
 * @see get_post_type_object()
 *
 * @param string $post_type Post type name.
 * @return bool Whether post type is registered.
 */
function post_type_exists($post_type)
{
    return (bool) get_post_type_object($post_type);
}

WordPress Version: 0.3

/**
 * 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.
 *
 * @since 3.0.0
 *
 * @see get_post_type_object()
 *
 * @param string $post_type Post type name.
 * @return bool Whether post type is registered.
 */
function post_type_exists($post_type)
{
    return (bool) get_post_type_object($post_type);
}

WordPress Version: .20

/**
 * 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.
 *
 * @since 3.0.0
 *
 * @see get_post_type_object()
 *
 * @param string $post_type Post type name.
 * @return bool Whether post type is registered.
 */
function post_type_exists($post_type)
{
    return (bool) get_post_type_object($post_type);
}

WordPress Version: 0.2

/**
 * 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.
 *
 * @since 3.0.0
 *
 * @see get_post_type_object()
 *
 * @param string $post_type Post type name.
 * @return bool Whether post type is registered.
 */
function post_type_exists($post_type)
{
    return (bool) get_post_type_object($post_type);
}

WordPress Version: .18

/**
 * 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.
 *
 * @since 3.0.0
 *
 * @see get_post_type_object()
 *
 * @param string $post_type Post type name.
 * @return bool Whether post type is registered.
 */
function post_type_exists($post_type)
{
    return (bool) get_post_type_object($post_type);
}

WordPress Version: 5.0

/**
 * 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.
 *
 * @since 3.0.0
 *
 * @see get_post_type_object()
 *
 * @param string $post_type Post type name.
 * @return bool Whether post type is registered.
 */
function post_type_exists($post_type)
{
    return (bool) get_post_type_object($post_type);
}

WordPress Version: 4.0

/**
 * Check if a post type is registered.
 *
 * @since 3.0.0
 *
 * @see get_post_type_object()
 *
 * @param string $post_type Post type name.
 * @return bool Whether post type is registered.
 */
function post_type_exists($post_type)
{
    return (bool) get_post_type_object($post_type);
}

WordPress Version: 3.7

/**
 * Checks if a post type is registered.
 *
 * @since 3.0.0
 * @uses get_post_type_object()
 *
 * @param string $post_type Post type name
 * @return bool Whether post type is registered.
 */
function post_type_exists($post_type)
{
    return (bool) get_post_type_object($post_type);
}