WordPress.org

Make WordPress Core

Ticket #23255: get-post-format.2.diff

File get-post-format.2.diff, 742 bytes (added by adamsilverstein, 5 years ago)
  • wp-includes/post.php

     
    758758 *
    759759 * @since 3.1.0
    760760 *
    761  * @param int|object $post A post
     761 * @param int|object $post Post ID or post object. Optional, default is the current post from the loop.
    762762 *
    763763 * @return mixed The format if successful. False if no format is set. WP_Error if errors.
    764764 */
    765765function get_post_format( $post = null ) {
    766         $post = get_post($post);
     766        $post = get_post( $post );
    767767
     768        if ( empty( $post ) )
     769                return new WP_Error( 'invalid_post', __( 'Invalid post' ) );
     770
    768771        if ( ! post_type_supports( $post->post_type, 'post-formats' ) )
    769772                return false;
    770773