WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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 have somee Item in the media library, where I want to retrieve the thunbnail from. I use the normal post thumbnail functions (tried some of them), with normal posts or cpts's the work fine.

As media library items are handled, similiar to posts, I thought the normal wp thumb function could work there, too. There are also thumbs created, as i can see on the server.

But no one fo WP's Thumb Fuunctions returns that thumb.

Here an example Function, I use:

 <?php echo get_the_post_thumbnail($post->ID, 'size-1'); ?>

The post ID is correct. The Thumbnail size is registered and works for other posts fine.

Thank YOu!

share|improve this question
up vote 0 down vote accepted

wp_get_attachment_image($post->ID, 'size-1');

The "post thumbnail" actually gets the featured image that is attached to the post. For an attachment, you want the attachment itself in a specific size, which isn't the same as the featured image.

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.