To get all featured images belonging to a certain post type, you’d have to get all those posts and the loop through them to get the featured image. Like this:
$query = new WP_Query( array(
'post_type' => 'yourposttype',
'posts_per_page'=>-1,
));
$thumb_list = array ();
if ( $query->have_posts() ) {
while ( $query->have_posts() ) {
$query->the_post();
$thumb_list[] = get_post_thumbnail_id();
}
wp_reset_postdata(); // resetting for the main query
}
Related Posts:
- Get images attached to a specific page
- Programmatically adding images to media library
- Upload images to remote server
- Uploaded images don’t show in Media Library if there are special characters in IPTC Keywords
- How can I hide media library images from general users?
- Use Media Library to manage galleries like Nextgen (with folders, albums, collections, tags, categories, terms…)
- How do i upload an image and return the image id?
- Regenerate missing _wp_attachment_metadata
- How to make programmatic image upload generate thumbnail and sizes?
- Best way to strip character entities (%20 etc)
- Different upload path per file type
- Is there a way to get attachment data?
- Link to full size image or attachment page in photo theme
- HTTP Error when uploading files above 7mb unless using GD Image Editor
- Bulk edit of EXIF data for jpeg images uploaded in the media library?
- Handling image uploads without thickbox
- Pull images from the gallery
- How to open default wp image editor screen dynamically?
- Searching for any images in media library displays “no media found”
- How to get file URL from media library
- Images uploaded to the media library has strange colors. However, in the edit screen the color is ok
- Why does WP allow to view and media item as a page
- Is there a way in WordPress to convert images to WebP without a plugin?
- Auto delete pictures in media library by age
- Attachments without images
- WordPress append -1 to the image name
- unsharp thumbnails after uploading image
- Post-processing of the image failed
- Unable to delete images in Media Library
- Edit image itself
- Missing Images in Uploads Directory (Server Only)
- Broken Media Library
- Media Library is not loading on grid view in admin panel
- Blurry Images WordPress 5.8.1
- Why some images are not allowed to be edited only for thumbnails?
- How can I use an image from an external source without uploading it to the media library
- Media Library Issues
- How to Fix HTTP Error When Uploading Images?
- Which filters or actions to use after a media upload and delete?
- wp_get_attachment_image_src and server path
- Media Upload Folder – how to manage
- Why is wp_get_attachment_image_src not working with my custom size (add_image_size)
- How to rename an image attachment filename using php
- Programatically creating image attachments from local URLs and setting featured image
- Get Attachment ID from URL [duplicate]
- WordPress function: limit size, only jpg, jpeg, limit of uploaded files per account
- Upload images using FTP and show them in media
- Applying class to links around self hosted images embedded to posts/pages
- Pulling Post Image Attachments in WordPress 3.9
- Import Images from one self-hosted WordPress install to another
- Link Featured Thumb to Attachment Page, If Possible
- How can I autopopulate titles in the media library?
- Upload thousands of images to WordPress without plugin?
- Image still linked as attachment to page even though it has been deleted
- What’s the best “insert all images” plugin?
- How to upload images in a specific folder using API
- AJAX – save an $_FILES picture in media library
- In Wordress one author can not see the other’s author uploaded images through media library
- How to prevent WordPress scaling large images down
- Change wp-content/uploads to uploads/%postname%/%image%
- Unable to upload images to the Media Library. Getting this erron on the console wp-admin/async-upload.php 403 (Forbidden)
- Is it possible to change image size used for preview thumnail in Add Media popup
- Call to undefined function wp_generate_attachment_metadata()
- Create a post from every image in my media gallery
- Retrieve Image Attachments Getting Post Thumbnail Image First
- Why WordPress suddenly changed sizes of thumbnails?
- How to get the title of the random images from media library?
- How to test if there are no more previous or next image on attachment page?
- Show last 12 uploaded images on home page, but only from posts
- How to change the value “uploaded to” in the media library (WordPress 4.0)
- Get an image from the media library. Struggling with the code?
- User uploads image as “Featured Image” but WordPress resizes it?
- Profile image does not upload
- Allow wp media library to check already selected images displayed in div
- Allow a specific user role I have created to only upload one image to his media library
- How can i set media attachments to the author of the post or page for already existed posts with attachments
- How to display the Media Library Items Upload date
- Upload error on localhost (at minimum, not yet tested online)
- Images not loading on webpage, and links to other media give 404 Not Found
- Generate links on all images in posts – is there a hook?
- Blank image thumbnails in media library
- Use wget to find used images
- How to handle a lot of media files in the uploads folder? (+10.000)
- Get “Image CSS Class” value from the Advanced Options section
- Uploaded images not showing properly using wordpress
- add titles to images in ad media in pages and posts
- attachment.php & flexslider—linking thumbnail to specific image
- Surround uploaded image link with div
- Setting name of attachment URL
- Show title when inserting single images
- greater flexibility in targeting images attached to page
- Stop Attachment image names from taking top level permalink
- How do I change a Themes Header Image?
- Remote Image (from URL) as Media Library element
- What does WordPress media uploader do to image files on upload?
- Is there a way to upscale a media library original image to the nearest whole pixel in WordPress?
- How to make Media Library files private?
- ‘Add Media’ to post – filter images
- Why are PDF thumbnails over-saturated?
- wp_get_attachment_image with custom size not rendering possible 2x srcset image