I'm adding additional image sizes to my theme:


add_image_size( 'my-thumbnails', 122, 122, true );  

I used to get thumbnails URL like this:


And it works like a charm, but I'm not sure how to display 'my-thumbnails' version of the thumbnail?

This doesn't work:

wp_get_attachment_image_src( get_post_thumbnail_id($post->ID),'my-thumbnails' );  

What's wrong?

3 Answers 3


You should use one of the following:

// Thumbnail
wp_get_attachment_thumb_file( $GLOBALS['post']->ID );

// Custom
wp_get_attachment_image_src( $attachment_id, $size='my-thumbnails' );
// Or:
wp_get_attachment_image( $attachment_id, $size='my-thumbnails' );
  • Shouldn't this be $size='my-thumbnails' instead of $size='thumbnail' to answer the question fully correctly? Commented Aug 19, 2016 at 17:36
  • @MikeKormendy thumbnail is the default builtin value
    – kaiser
    Commented Aug 19, 2016 at 17:42
  • I think we answered the question fully... My comment included. Commented Aug 20, 2016 at 20:21
  • You can edit and clean up comments. Comments are not part of the answer and only temp.
    – kaiser
    Commented Aug 20, 2016 at 20:53
  • @MikeKormendy how about explaining what is the default?
    – kaiser
    Commented Aug 22, 2016 at 4:49

If you're using the thumbnail as a featured image

the_post_thumbnail( 'my-thumbnails' );

make your own function in function.php for display your images, then call it and put the size on the parameters of the function.

  • Are you sure there is no other way? Commented Aug 18, 2011 at 23:15
  • well, is the better way, no?, or what do you have in mind?
    – eveevans
    Commented Aug 19, 2011 at 0:19

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.