WordPress.org

Make WordPress Core

Ticket #12588: post.php.diff

File post.php.diff, 666 bytes (added by sirzooro, 4 years ago)

Default 1st param to all post types

  • post.php

    old new  
    692692} 
    693693 
    694694/** 
     695 * Check if the current or specified post is a post type 
     696 * 
     697 * @since 3.0 
     698 * @uses get_post_type() 
     699 * 
     700 * @param string|array $types Type or types to check. Defaults to all post types. 
     701 * @param int $id Post ID. Defaults to current ID. 
     702 * @return bool 
     703 */ 
     704function is_post_type( $types = false, $id = false ) { 
     705        if ( $types === false ) 
     706                $types = get_post_types(); 
     707        return in_array( get_post_type( $id ), (array) $types ); 
     708} 
     709 
     710/** 
    695711 * Retrieve the post type of the current post or of a given post. 
    696712 * 
    697713 * @since 2.1.0