mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-17 03:56:07 +00:00
Fix to is_post_type. props scribu, fixes #12588.
git-svn-id: http://svn.automattic.com/wordpress/trunk@14498 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
6275f204a8
commit
1c05c2f6e2
@ -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
|
* @since 3.0.0
|
||||||
* @uses get_post_type()
|
* @uses get_post_type()
|
||||||
@ -691,8 +691,13 @@ function is_post_type_hierarchical( $post = false ) {
|
|||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function is_post_type( $types = false, $id = false ) {
|
function is_post_type( $types = false, $id = false ) {
|
||||||
$types = ( $types === false ) ? get_post_types() : (array) $types;
|
if ( $id ) {
|
||||||
return in_array( get_post_type( $id ), $types );
|
$types = ( $types === false ) ? get_post_types() : (array) $types;
|
||||||
|
|
||||||
|
return in_array( get_post_type( $id ), $types );
|
||||||
|
}
|
||||||
|
|
||||||
|
return (bool) get_post_type_object($types);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user