2

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.

6
  • Just a wild guess, have you declared the post thumbnail support? Have you tried calling other image sizes?
    – Abhik
    Dec 22, 2015 at 12:19
  • @Abhik I can get all other sizes correctly, so I guess thre is thumbnail support? Only I cannot get the full image size, instead i get the cropped size.
    – jay
    Dec 22, 2015 at 12:25
  • Can you post the context where you are using the_post_thumbnail()? It must be inside the loop.
    – cybmeta
    Dec 22, 2015 at 12:30
  • @cybmeta it's on the single post, within the loop. As I wrote in my question, I can see all other sizes only the full size is not among them.
    – jay
    Dec 22, 2015 at 12:45
  • It's your own theme? Check if the theme doesn't remove the full size.
    – Nozifel
    Dec 22, 2015 at 13:16

1 Answer 1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.