Fix to is_post_type. props scribu, fixes #12588.

git-svn-id: https://develop.svn.wordpress.org/trunk@14498 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin 2010-05-07 04:57:23 +00:00
parent 40aa2e543b
commit ec9d233b8b
1 changed files with 8 additions and 3 deletions

View File

@ -681,7 +681,7 @@ function is_post_type_hierarchical( $post = false ) {
}
/**
* Checks if a post type is registered, can also check if the current or specified post is of a post type.
* Checks if a post type is registered. Can also check if the current or specified post is of a post type.
*
* @since 3.0.0
* @uses get_post_type()
@ -691,8 +691,13 @@ function is_post_type_hierarchical( $post = false ) {
* @return bool
*/
function is_post_type( $types = false, $id = false ) {
if ( $id ) {
$types = ( $types === false ) ? get_post_types() : (array) $types;
return in_array( get_post_type( $id ), $types );
}
return (bool) get_post_type_object($types);
}
/**