get_thumbnail_id returns full size image

Hey First add this line into your function.php file

add_image_size( 'custom-size', 120, 140 );

Then call custom-size like this

<?php $thumb_id = get_post_thumbnail_id( $id );
                if ( '' != $thumb_id ) {
                    $thumb_url  = wp_get_attachment_image_src( $thumb_id, 'custom-size', true );
                    $image      = $thumb_url[0];
                }?>
            <img src="https://wordpress.stackexchange.com/questions/172703/<?php echo $image;?>">

I think it work fine

Leave a Comment