I want to get a 'smaller' thumbnail of a large image I have uploaded through the built in word-press media up-loader.

I have briefly looked at get_the_post_thumbnail but I don't think that is the correct function I want because the images I want to get thumbnails are not 'featured images'

Gets the Featured Image (formerly called Post Thumbnail) as set in post's or page's edit screen and returns an HTML image element representing a Featured Image, if there is any, otherwise an empty string.

I am sure I saw wp spit out a number of images when I uploaded the last one. How can I access these?

2 Answers 2


Where are you attempting to get the image? That should be the correct function:

global $post;
$image = get_the_post_thumbnail( $post->ID );

It will return an array of all the image sizes for that given image. You can then grab the image size out of the array, or better yet pass in a specific image size to the function to return the correct size:

global $post;
$image = get_the_post_thumbnail( $post->ID , 'thubmnail' );

as you can see we've passed in the 'thumbnail' image size. $image will then return the url to the image size. You can then use it in an image tag, like so:

<img src="<?php echo esc_attr( esc_url( $image ) ); ?>" alt="thumbnail image">

I think you are looking for wp_get_attachment_url

To get the image src, you can use wp_get_attachment_image_src

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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