I think the only solution you have at the moment is to disable all intermediate image sizes:
add_filter( 'intermediate_image_sizes', '__return_empty_array', 99 );
And then manually generate them, depending on the post type, by hooking into ‘wp_generate_attachment_metadata’, where you do have access to the attachment id (and therefore to it’s parent post):
function do_your_stuff( $data, $attachment_id ) {
// generate intermediate images
return $data;
}
add_filter( 'wp_generate_attachment_metadata', 'do_your_stuff', 10, 2 );
Related Posts:
- add_image_size() for specific Post Types
- set_post_thumbnail_size in percent, not pixels?
- Removing Image Sizes for Custom Post Type
- Image size filtering in Media uploader according to custom post type
- add_image_size for post type
- How to rename image at uploading on specific plugin or post-type in WordPress
- Change post featured image on hover
- Custom Image Thumbnails of Different Sizes
- Force documents to appear in Featured Image dialogue
- Get image post ID in media upload
- Link to full size post thumbnail
- Multiple featured sizes / images / excerpts
- How can i add thumbnails images to particular post (using code not admin pannel) in wordpress
- How to Create an Image Upload Box for Custom Posts?
- frontend image post uploader
- Redirect to another page using contact form 7? [closed]
- How to add multiple images to a custom post type without plugin [closed]
- Is it possible to add posts and images (auto resize) for custom post types with a script?
- Using Image Sizes for Custom Post Types outside the Loop
- link featured image to external link
- Cannot upload featured image to a custom post type
- Thumbnails Not Generating
- Multi Photo Upload with Caption on Front End for Custom Post Type
- Allow authors to create article image
- Front end post or photo or both
- set_post_thumbnail or media_sideload_image adds image multiple times in media library
- How to Create Grey Background for Product Images on Website Display but Retain White Background on Downloaded JPGs?
- Hide editor while keeping add media button in custom post type
- Add a button or image button that calls wp functions in the wp-admin
- Custom Post Type with image gallery
- Add custom image size for custom post type or taxonomy
- How to get the upcoming post ID from front end?
- How to automatically set ‘default image size’ for specific Custom Post Type
- How to stop thumbnail generation from some images and different size thumbnail generate
- Custom Post Type Video – Online/Offline
- Problem: wp_query outputs all images on site
- unable to show custom post type featured image
- How to replace images?
- Problems with image size on the server WordPress
- How to update post meta on uploaded image from a custom form?
- Can’t generate thumbnail images
- Adding custom image sizes and post types to a plugin or to a theme?
- Checking if $_FILE isset for an array of file upload metaboxes
- How do you create a custom template to display a category with an image and related posts below?
- How to: wordpress job listing and candidates details
- How to handle large number of images in a post?
- Original image not saving?
- How do you get the full size url of an attachment image
- how to post default thumbnail if post not created yet
- get_the_post_thumbnail_url(‘full’) returns empty from custom post type
- Set featured image to archive.php
- Unable to set featured image
- Post-thumbnail only for specific post-types?
- Why won’t this jQuery code work?
- How can i link a custom post type thumbnail to intermediate size
- Featured image size in column
- False Positive on has_post_thumbnail
- How to set uploaded image as featured image wordpress
- 3 random images from custom post type, each in a div with a diffrent class
- Custom post doesn’t show featured image
- Create a custom post type for a photo post
- How do you output an unknown number of images in a custom post type with desired markup?
- Auto post creation
- copy images from custom field to another custom field
- File sharing platform for user contributions? [closed]
- Dynamic pages for linked categories and content
- Get featured image with custom size outside WordPress
- Dynamically determine the width and height of a image file to be cropped & uploaded AFTER form submission given fixed aspect ratio
- How to Make Thumbnail of Post Stay Animated
- adding image to post thumbnail from another server
- Invalid file type when using wp_upload_bits to upload PDF to a custom post type
- Insert into post button missing on custom post type
- Should i use custom post type for a custom footer?
- Add Permalink to Post Thumbnail, syntax code issues
- Returning an image url from its attachment ID using a custom post type plugin
- Need help with simple “if statement” checks to output particlular CPT data depending on what client uploads/fills out
- Images not load on custom post type sidebar, related posts
- Not Able to Add New Class To CPT Attachment Image
- How to add Support to show Fullwidth Featured Image of Custom Post Types in WordPress.?
- i need to have a tab with gategory post
- Put featured image under post title in admin area
- How to add a default predefined thumbnail when creating a brand new post?
- Why this didn’t work if i use get_the_ID(), but works if i pass the numeric id
- WordPress Multisite: Images moved to /sites/1?
- DIVI Theme customizer changes not applied on existing pages and designs are not shown on the front
- How to delete original image file after upload and resize
- An error has occurred during the upload process in wordpress version 5.3.2
- How can I add image sizes for a specific custom post type?
- Change picture attachment meta of all occurrences of a picture
- Dupplication of Custom Post Type while adding attachment
- Media is not showing on post page
- Make it impossible to save a custom post type with both video and image selected?
- Looping through image object using ACF and CPT UI [SOLVED]
- Display featured images from custom post type in the homepage template
- Displaying image instead of post label in wordpress
- Links Image in “Catalog” Page to Posts
- why featured image option isn’t showing in custom post type?
- Redimension thumbnail crop without creating new images
- Add featured image programatically to custom post type
- Troubles with code for upload a image