Has wp_get_attachment_image_src changed from 3.2.1 to 3.5.2?

Try this first

Make sure that the post in question has its Featured Image (formerly Post Thumbnail) set.

Then…

Going by our comment thread, here’s something else to try.

function gangmei_get_the_post_thumbnail_url($post_id = NULL) {
    /*
     * global $id;
     * $post_id = (NULL === $post_id) ? $id : $post_id;
     * $src = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), 'full');
     * $src = $src[0];
     */
    global $post;
    if( NULL === $post_id ) {
        $post_id = $post->ID;
    }
    $src = wp_get_attachment_image_src( get_post_thumbnail_id( $post_id ) );
    if( !is_array( $src ) && ! $src ) {
        return false; // there's an error somewhere
    }
    return $src[0];
}

Leave a Comment