I need to prevent uploading bmp image for user. How can it be possible?
|
The magic is in
so hooking into that filter and removing
Just copy that over into a file named |
|||||||||||
|
|
I have found the solution from here. And its working! WordPress has a set of restricted filetypes it will allow you to upload via the media library. Whilst this is a great security feature, there may be times where you’d like to add other files that are restricted by default, or maybe even the opposite where you’d only like to allow a few extensions to be uploaded. Fortunately, WordPress makes this dead easy with a small snippet of PHP code. If you’d like to add or remove a specific filetype that can be uploaded to wordpress via the media library, you can insert this PHP code in your theme functions.php file:
Here is an example of what you can do to add and remove a new filetype (in this example, I’m adding an extension that already exists, but the concept is the same):
You can also reset the allowed filetypes by creating a new array within the function and returning these values:
If you’d like to see what filetypes are currently supported by wordpress, check out the function get_allowed_mime_types located in the wp-includes/functions.php file. |
|||
|
|
