The magic is in get_allowed_mime_types()
which calls the upload_mimes
filter. That is filtering a default array consisting of keys as a non-terminated regular expression of file-extensions and the mapped mime-type as values:
array(
'jpg|jpeg|jpe' => 'image/jpeg',
'gif' => 'image/gif',
'png' => 'image/png',
'bmp' => 'image/bmp',
'tif|tiff' => 'image/tiff',
'ico' => 'image/x-icon',
....
}
so hooking into that filter and removing bmp
should do the job for the moment:
/** prevent uploading of .bmp files. */
add_filter('upload_mimes', function(array $mimes)
{
unset($mimes['bmp']);
return $mimes;
})
;
Just copy that over into a file named no-bmp-upload.php
and place it into the wp-content\mu-plugins
folder.
Related Posts:
- How to generate thumbnails when needed only?
- No Thumbnails Generated
- How to Require a Minimum Image Dimension for Uploading?
- How does WP media uploader create the 3 different sized images, and how can I duplicate it
- Reject upload of wrong-sized images using the Media Uploader
- Create image formats with different qualities when uploading
- Which filters or actions to use after a media upload and delete?
- PNG with transparent background turns black when uploaded and resized
- Settings in ‘Media > Settings’ is ignored when inserting images
- There’s a way to scale media (images) at 50%?
- How to prevent upload of a multiple sizes of images
- Impose a Maximum Limit on Image height and width upload size
- Force wordpress to see uploads folder media
- Convert uploaded PNG to JPEG automatically
- add_image_size creating lots of images (of various sizes)
- resize images not crop
- Add suffix to filename of uploaded images
- How to link to the image editor’s Edit Image function?
- Regenerate thumbnails after upload
- Front-end Image Upload with Preview – Is this Possible in WP?
- WordPress won’t generate image sizes for certain images
- Thumbnails produce unwanted gray pixels on white background [closed]
- Site icons with alpha channel for self-hosted WordPress blog network
- How can I receive the image id using the media box?
- Can I stop wordpress generating media sizes
- add_image_size() and uploading the exact size leaves 1×1 image in uploads
- WordPress Fancybox Resize Large Image
- Error uploading images (but the images are at the server!)
- How to generate thumbnails when needed only?
- WordPress Media Library showing wrong preview size?
- add_image_size adds size, but doesn’t upload if source resolution is same as resize resolution
- Original image not saving?
- Process uploads with phpThumb before generating thumbnails
- Resize existing library images
- Large image upload size (using timthumb.php
- Image resizing – TimThumb vs convert on upload?
- WordPress Bug on IIS ? Problem when uploading image on IIS 7
- When does WP resize an image file
- Stop image resizing in particular case – is that possible?
- Issue with images which have no sizes available
- How to resize attachement
- Best way to receive special images in posts
- Resize uploaded original images to a minimum automatically
- Dynamically determine the width and height of a image file to be cropped & uploaded AFTER form submission given fixed aspect ratio
- Control resizing of uploaded images
- Images uploaded via Gutenberg image block are cropped
- Set default “Link CSS Class” in add media admin editor
- Images not aligning correctly
- Redimension thumbnail crop without creating new images
- get the post thumbnail returns the full size
- WordPress Image Resize fails without Error Message
- How to force attachment size for every post
- Image upload callback in new 3.5 media
- How to wp_upload_bits() to a sub-folder?
- Is it possible to trigger some JavaScript when Media Popup is opened?
- Media Uploader: get deleted files
- Replace all of post’s image URLs with upload directory URLs
- front end post with multiple upload images?
- Restrict the number of images to upload per post
- Restrict file uploads by extension?
- Select image sizes you want to be uploaded
- Uploading images to Media Library fails with Memory Exhausted
- Edit image preview is not displayed
- What error logs can I check to see why plugin updates are failing?
- How to set a Minimum Image Dimension for Uploading
- Media library not loading after switching the main site of multisite
- Multisite media library uploads broken images
- Different upload path per file type
- HTML tags in WordPress image caption
- Get most recent media upload
- WordPress HTTP Error on File upload
- Find unused images?
- Custom “Insert into Post” button
- Switch between tabs on “Insert Media” dialog
- Site running slow on new server?
- “send_to_editor” function returning pdf file name
- Choosing images size when uploading
- Easing the download of a regularly uploaded pdf
- Get all images in uploads directory and list them
- Upload media only to DB
- Is it possible to import all files from a uploads DIR into WP media, retaining paths to the files
- Embed HTML5 files/subfolders in post?
- How to change archieve frequency of the media file in uploads folder for wordpress blog
- How can i identify media uploaded to my website that is not being used anywhere anymore?
- image URL changed in wordpress
- Insert attachments from custom uploader into post (regular uploader style)
- Images not uploading on product page of woocommercr
- How to download CSV from sub directory in uploads folder
- Import media (.xml) does not attribute featured images to posts
- Updated wordpress missing image upload area
- Sanitizing existing media library paths and page links from foreign characters
- How to change default upload dir?
- How could you allow users to upload a video in within their profile and display it on a wordpress site?
- restrict uploaded image size and fixed image display size
- Limit attachment caption characters
- WAMP install acts different than live install when uploading images
- Password protected uploaded PDF page
- How can I hook and edit on the fly an image uploaded
- What does WordPress media uploader do to image files on upload?
- Leveraging Core Functionality in Icon Upload Plugin [closed]