WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 2 down vote accepted

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='thumbnail' );
// Or:
wp_get_attachment_image( $attachment_id, $size = 'thumbnail' );
share|improve this answer

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

share|improve this answer
Are you sure there is no other way? – Wordpressor Aug 18 '11 at 23:15
well, is the better way, no?, or what do you have in mind? – eveevans Aug 19 '11 at 0:19

If you're using the thumbnail as a featured image

the_post_thumbnail( 'my-thumbnails' );
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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