Make WordPress Core

Ticket #44772: 44772.diff

File 44772.diff, 765 bytes (added by soulseekah, 7 years ago)
  • src/wp-includes/post-thumbnail-template.php

    diff --git src/wp-includes/post-thumbnail-template.php src/wp-includes/post-thumbnail-template.php
    index c20e2df..9bda89d 100644
    function has_post_thumbnail( $post = null ) { 
    3636 * @return string|int Post thumbnail ID or empty string.
    3737 */
    3838function get_post_thumbnail_id( $post = null ) {
    39         $post = get_post( $post );
    40         if ( ! $post ) {
    41                 return '';
     39        if ( ! is_numeric( $post ) ) {
     40                $post = get_post( $post );
     41
     42                if ( ! $post ) {
     43                        return '';
     44                }
     45
     46                $post_id = $post->ID;
     47        } else {
     48                $post_id = $post;
    4249        }
    43         return get_post_meta( $post->ID, '_thumbnail_id', true );
     50
     51        return get_post_meta( $post_id, '_thumbnail_id', true );
    4452}
    4553
    4654/**