Please Try Below Codes:
add_filter( 'intermediate_image_sizes_advanced', 'prefix_remove_default_images' );
function prefix_remove_default_images( $sizes ) {
if (preg_match('/(hd)/', get_attached_file( $attachment_id )) {
unset( $sizes['small']); // 150px
unset( $sizes['medium']); // 300px
unset( $sizes['large']); // 1024px
unset( $sizes['medium_large']); // 768px
return $sizes;
}
}
And You can use Stop Generating Unnecessary Thumbnails WordPress Plugin to disable for all images size very easily.
Related Posts:
- Set JPEG compression for specific custom image sizes
- Removing default image size list in Media Box
- How to reduce original image quality on upload?
- Custom image size in Media Dropdown
- Best way to programatically add “rel” attributes to page and post images
- Images uploaded using media uploader are appearing upside down
- Publish/Update post is changing image links from file url to post url
- Can’t generate thumbnail images
- Redirect to another page using contact form 7? [closed]
- Possible to hook into Media Library preview File column and use a custom image?
- Is it possible to limit number of files a non-admin user can upload via the WordPress media library?
- How to add HTML into error message
- restrict uploaded image size and fixed image display size
- Zip all (original) images from media gallery
- How to overwrite image if it already exists – WordPress, Gravity form
- Missing feature image link function
- Upload Multiple Files With media_handle_upload
- Issues with title-tag and document_title_parts
- How to change the markup WordPress inserts for post images
- How to get the image EXIF date/time and use it for the WP post date/time
- Programmatically Set First Image as Featured
- WP 4.4. responsive loads normal image after loading the responsive image
- How to register images uploaded via FTP in media library?
- delete uploaded file
- Set image size on media and text block with a function
- Convert hyphen to underscore in permalinks
- Programmatically Add Font-Awesome Icons to Category Widget
- Remove bulk actions based on user role or capabilities
- Create thumbnail on PDF upload with Gravity Forms
- Remove images from get_the_excerpt
- How to change a certain text or term of WordPress into a custom into the whole site?
- Adding body class when post contains a specific shortcode
- Insert width & height attributes to all images displayed on each page
- Allowing SVG uploads in media uploader without plug-in
- Manipulate Output of wp_list_something: select menu instead of li’s
- Overwrite Parent Theme add_image_size in Child Theme
- Show excerpt for only first post in query
- Add custom image size not working
- Convert all images to PNG on file upload
- wp_get_attachment_image function size argument not working if I also add a custom class
- Can’t check if a post has thumbnail adding filter to get_post_metadata()
- WordPress upload_mimes not working for front-end uploads of 3D files
- Understanding and altering the structure of posted images
- Passing values from a widget to a function within a plugin
- Featured Image Thumbnail Creation
- Can you put a condition on add_image_size() depending on the width of the uploaded image?
- Is possible add icon in title posts only in specific tag?
- Remove after images
- Adding an external HTML link to a post thumbnail
- Replace a menu with widget or a custom template file programmatically
- woocommerce change currency per category [closed]
- Modify post filter to set custom number of posts per page and exclude child posts
- Make wp_link_pages() suitable for Twitter Bootstrap markup
- Setting a default text for excerpts of a particular category
- How to edit the Tags within the image file URLs?
- Add_filter when value is no variable?
- How to edit classes in body tag?
- How to hide image-url if no attachment?
- How to stop media_sideload_image from running when deleting a post?
- How to display the_archive_title() and the_archive_description() – “weird” interaction
- How to properly set custom logo size?
- Native gallery custom html output
- The_content and Preg_replace in loaded Iframe [closed]
- How to edit/replace Parent functions.php function in Child Theme to add “Walker” class
- Functions Filter Question [closed]
- Image Crop Not Working
- Use existing image sizes for WooCommerce
- wp_get_attachment_image_src returns image on main domain, false on subdomain
- Retrieve First Image Function
- Featured Image keeps cropping
- Prevent creating multiple image resizes in twentytwelve template
- Any adverse effects of adding apply_filters to a function?
- Adding custom social icons to the social media icon block in the Gutenberg editor?
- Auto delete content in specific folder inside media library
- How to update an image attachment’s alt text from a custom field when saving a post?
- large image size of 1440×1440 not pulling 2x of 2880×2880 image
- post value to function with Ajax and jQuery
- How Do I Unhook This Parent Theme Function?
- Allow user only create specific tags
- Can You Set A Minimum Image Dimension For Resizing Images?
- Child theme remove parent filter in functions
- (Divi): How to make WordPress load images of specific size for Blurb modules on given page with a funciton?
- Remove External Links from WordPress posts Using add_filter() in Theme functions.php
- Hide disclaimer from summary excerpts
- Function image_send_to_editor returns emty title tag
- Using Switch Statement to Change Image According to Last Digit of Topic ID
- Disable links to images only if link is an image
- Restricted images only for logged user. (hidden url)
- Only seems to be displaying one child when there are supposed to be multiple
- Shortcode to eliminate and replace with
- Search and Replace Script Loader in Head Only Works in Footer
- Problem in outputting shortcode
- Open image size links in a page instead of direct image link
- How to Add A Rel Filter to All Links?
- Allow tags and attributes in post and pages content
- Override parent theme function that is not hooked or in the functions.php file
- child_of not working while searching
- Function to get thumbnail img source
- How to Insert A List of Posts in A Category Written by the Author into the Author Archive
- Filter to strip unnecessary attributes