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
- Restricting users to view only media library items they have uploaded?
- How to Fix HTTP Error When Uploading Images?
- Programmatically get images by URL and save in uploads folder
- Prevent WordPress from generating medium_large 768px size of image uploads?
- how to get original image using wp_get_attachment_image_src
- Can I attach image to post without adding it to post?
- Set default image link target in Gutenberg image block
- How to delete resized (cropped) image uploads and prevent future resizing?
- How can I bulk delete media and attachments using WP-CLI?
- What’s the proper way to find and remove duplicate images from posts and the media library?
- Which filters or actions to use after a media upload and delete?
- wp_get_attachment_image_src and server path
- Separate Media Library for each user
- Using Images in WordPress – Best Practices
- How to find attachment by it’s name?
- Media Upload Folder – how to manage
- How to set the default embed image size
- Why is wp_get_attachment_image_src not working with my custom size (add_image_size)
- How do I detach images from posts?
- How do I delete all generated images from my server except those currently used in posts
- Get all posts (of any post type) an attachment is used in
- Insert an image into a post by API
- Function to call the attachment image from post
- Password protect some uploaded files, so only logged-in users can view them
- Unattaching unlinked images
- Theme Customiser Image Control
- Images dont show in grid view, but do in list view
- Get attachment ID of author_meta image – Attachment Metadata
- Associate an existing image with a post
- How to rename an image attachment filename using php
- Programatically creating image attachments from local URLs and setting featured image
- Filter Media Library by author or post_parent
- Remove duplicate images from media library.
- My subdirectory sites images (except webP) are throwing to 404 page even they are exist
- WordPress API, creating Featured Media from image url (nodejs)
- How to import external media items into wordpress media library (without using storage)
- Delete all thumbnails & regenerate them?
- Broken images after importing posts and opening in Gutenberg
- Image Attachments Query Not Working If Post Is Loaded Via Ajax
- What does WordPress media uploader do to image files on upload?
- Media Library shows default image instead of image preview
- How to get WordPress to resize images for srcset?
- Remove one srcset entry from wp_get_attachment_image
- Attachment tag archive
- Images have dissapeared from media library and site
- Uploading media to wordpress API with C# HttpClient
- 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?
- Get field added via attachment_fields_to_edit filter in Gutenberg
- Define how an attached image is rendered
- Trying WP editor to load full size image (not ‘300×300’)
- ‘Add Media’ to post – filter images
- “Media Library” shows as empty, despite images being present
- Why are PDF thumbnails over-saturated?
- How to add year and month path to old attachment images?
- How to upload multiple images to use as gallery in Kirki Framework
- How can I get or the intermediate size of an image with wp_get_attachment_image_src without using post meta?
- How do I display a PDF thumbnail as a link to the PDF without uploading the image
- I can’t see all images in my media library – How Can I reset the index of that library?
- wp_get_attachment_image with custom size not rendering possible 2x srcset image
- Convert base64 string to WordPress attachment uploads multiple images instead of a single one
- How do you detect when an image has been deleted from WordPress media library?
- Featured Image add tab