Cannot get full thumbnail size using the_post_thumbnail

I cannot get the full (unmodified) image size using

the_post_thumbnail( 'full' );

I have also tried:

the_post_thumbnail();

It still returns the cropped image. I can see that the unmodified size is uploaded on the server and there is no problem with that.
I checked using

print_r(get_intermediate_image_sizes());

And it returns following sizes:

Array
(
    [0] => thumbnail
    [1] => medium
    [2] => medium_large
    [3] => large
    [4] => custom_size1
)

Why there is no full size? Has something changed in the WordPress recent versions or is it something else? Thanks.

Edit: I have figured out that it is the WordPress srcset which is adding multiple image sizes in the URL and it uses the smaller image.

1 Answer
1

Try to add custom thumbnail size with unlimited(very big) hegiht and width in functions.php with following code:

add_theme_support( 'post-thumbnails' );
add_image_size( 'custom', 9999, 9999 );

It will not crop any images. So you can use it as the_post_thumbnail( 'custom' );

This method looks rough but you can use if other ways don’t work. And if you already have images, you can use regenerate thumbnails plugin.

Leave a Comment