image_make_intermediate_size was not the hook I was looking for, but intermediate_image_sizes_advanced.
Here is a working code:
function disable_upload_sizes( $sizes, $metadata ) {
// Get filetype data.
$filetype = wp_check_filetype($metadata['file']);
// Check if is gif.
if($filetype['type'] == 'image/gif') {
// Unset sizes if file is gif.
$sizes = array();
}
// Return sizes you want to create from image (None if image is gif.)
return $sizes;
}
add_filter('intermediate_image_sizes_advanced', 'disable_upload_sizes', 10, 2);
Related Posts:
- wp_upload_bits Upload Specific Sizes Only
- Removing Image and Caption Dimension Attributes
- Changing JPEG compression depending on image size
- Change upload directory on custom plugin page
- hook into completed image upload filter
- WP Rest API – Upload media without saving attachment post
- Can I add custom meta for each image uploaded via media-upload.php?
- Rename image uploads replacing “width” and “height” in filename with “medium”, “large”, “small”
- Rename image uploads with width in filename
- WordPress 3.5+ upload tool filter
- Image size filtering in Media uploader according to custom post type
- Filter to modify post_title after image upload?
- How to check if “media_send_to_editor” is audio?
- Pass parameter to the upload_dir filter
- Allow EPS file upload – two EPS files have different MIME types
- Move a file from a directory to another
- Using wp_handle_upload() to Direct Specific Path by Using $overrides
- Disable auto-resizing of uploaded images, but only for certain filename
- upload_files cap to not loggen in users – add_cap to not logged in users
- Redirect to another page using contact form 7? [closed]
- Upload restrictions – upload_mimes – filter: Adding multiple MIMEs for a single extension and adding multiple extensions for a single MIME type?
- Filter causing loss of _wp_attachment_metadata
- Filter Media by attached page or blog post in Library
- How to display a warning when an uploaded image is too small?
- Show uploaded pdf files dynamically and filter by month name
- How to trigger “wp_handle_upload_prefilter” filter when uploading an image programatically?
- Overriding Generated Attachment Post URL
- List all image sizes still getting disabled sizes
- How to get to the date of the uploaded file
- How to replace all images in all posts and pages with a different size?
- Post Type Upload Directory – {post_type}_upload_dir filter
- can’t output gray scaled image I’ve created using add_image_size
- Rename uploads filenames to POST-ID on upload
- add_filter with specific thumb names
- How to show page content in feed?
- How to disable generation of default image sizes for some custom post types?
- Disable image attachment links
- remove_filter( ‘the_content’, ‘wpautop’ ); only for certain post types
- How to modify an image block in Gutenberg WordPress 5?
- Prevent image upload unless exact size
- Use Media upload in custom widget on wordpress 3.5
- How to change Woocommerce breadcrumbs content?
- I’m using a filter to remove the tags auto wrap, but there still wrapped elements?
- Format content value from DB outside of WordPress filters
- Cron schedule interval through plugin options?
- wpmu_signup_user_notification filter not working
- Filter oembeds tags to modify iframe attributes
- Removing labels and tag on WordPress’s default login form
- How to check a filter are applied
- How do I add a listbox to the TinyMCE editor?
- How to remove google font in WordPress for only single page?
- Why anything done on comments_array hook gets reset?
- get_header and hook avoid normal call
- Dropdown filter in custom posts
- How to get image ID to use inside wp_read_image_metadata()?
- How to order by taxonomy using wp_query
- Filter taxonomy admin pagination
- Add Image Size for one Media Category Only
- WP action/filter to modify title before header output and article output?
- Custom view counts not updating correctly
- How to Create an Image Upload Box for Custom Posts?
- Taxonomies image
- Disable all resizing and compression
- How to create Woocommerce Product Filter Widget [closed]
- What is the alternative to “ when it comes to calling Media (image) files in the ‘attachment.php’ file?
- using media_sideload_image with a file from theme directory
- Filtering Comment Reply Links (comment_reply_link_args) for “infinite replies” in nested comments
- Create Search Form to Filter Through Terms
- Blank upload.php page
- Conditional does not work with add_filter
- Pass debug_backtrace() in WordPress filter
- Convert canvas to image and upload image to server
- Problem with Class, Filters and Callbacks
- Renaming wordpress login and get new password button
- How can I change the to for lazyload wp smilies
- Parse a shortcode differently based on on what it’s nested in
- Convert all uploaded PNG files to PNG-8 format
- How to redirect template_directory to subdomain relativ url?
- How do I add tags to entire comments, not just their text
- unable to write to the database while uploading images
- Unset image sizes before images are uploaded
- Modify WordPress Page Title ()
- An error has occurred during the upload process in wordpress 5.3.2
- How to add lazy field in content endpoint using Gutenberg blocks
- how to use apply filter for Class?
- Set Microsoft Word links to open in new window/tab
- WordPress get_avatar filter to match logins
- ‘the_content’ Filter delivers empty string with lengh (608)
- Getting the Select and Crop Functionality Using Custom Fields
- Output dynamic_sidebar_params in wp_head
- How to sort posts according to meta value?
- Change shortcode output (filter?)
- Only User Upload image Http Error
- See the all uploaded images of a user as an admin
- remove_filter excerpt_more from a plugin class
- Broken Media Library
- 3.5.x Theme Customize: Handling Custom Control Requests
- Upload to a specific media folder created by FileBird Lite
- How To Convert External Image URLs To Own Website’s Uploaded Images Automatically?
- Adding filter to the Contact Form 7 response