WordPress.org

Make WordPress Core

Ticket #17262: 17262.2.diff

File 17262.2.diff, 1.0 KB (added by wonderboymusic, 5 years ago)
  • wp-includes/post.php

     
    42464246 */
    42474247function wp_get_attachment_thumb_file( $post_id = 0 ) {
    42484248        $post_id = (int) $post_id;
    4249         if ( !$post = get_post( $post_id ) )
     4249        if ( ! $post = get_post( $post_id ) )
    42504250                return false;
    4251         if ( !is_array( $imagedata = wp_get_attachment_metadata( $post->ID ) ) )
     4251        if ( ! is_array( $imagedata = wp_get_attachment_metadata( $post->ID ) ) )
    42524252                return false;
    42534253
    42544254        $file = get_attached_file( $post->ID );
    42554255
    4256         if ( !empty($imagedata['thumb']) && ($thumbfile = str_replace(basename($file), $imagedata['thumb'], $file)) && file_exists($thumbfile) )
     4256        if ( ! empty( $imagedata['sizes']['thumbnail']['file'] )
     4257                && ( $thumbfile = str_replace( basename( $file ), $imagedata['sizes']['thumbnail']['file'], $file ) )
     4258                && file_exists( $thumbfile ) )
    42574259                return apply_filters( 'wp_get_attachment_thumb_file', $thumbfile, $post->ID );
    42584260        return false;
    42594261}