Ticket #12588: is_post_type.diff
File is_post_type.diff, 891 bytes (added by , 15 years ago) |
---|
-
wp-includes/post.php
667 667 } 668 668 669 669 /** 670 * Checks if a post type is registered , can also check if the current or specified post is of a post type.670 * Checks if a post type is registered. Can also check if the current or specified post is of a post type. 671 671 * 672 672 * @since 3.0.0 673 673 * @uses get_post_type() … … 677 677 * @return bool 678 678 */ 679 679 function is_post_type( $types = false, $id = false ) { 680 $types = ( $types === false ) ? get_post_types() : (array) $types; 681 return in_array( get_post_type( $id ), $types ); 680 if ( $id ) { 681 $types = ( $types === false ) ? get_post_types() : (array) $types; 682 683 return in_array( get_post_type( $id ), $types ); 684 } 685 686 return (bool) get_post_type_object($types); 682 687 } 683 688 684 689 /**