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!

1 Answer 1


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.

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.