Ever tried to upload a file to your WordPress media library and received the error message; “Sorry, this file type is not permitted for security reasons?”
By default, WordPress restricts types of files you can upload to the media library for security purposes.
This means you are only able to upload common media files such a s DOC, PDF, JPEG among others.
However, there are ways you can employ to get around this restriction, if you are sure the file you want to upload is safe.
One is by adding a bit of code to your theme’s functions.php file, and the other is via plugin.
1. On your WordPress Dashboard, choose ‘Appearance’ from the list of options on the left pane.
2. Choose ‘Editor’ from the submenu.
3. choose Theme Functions or functions.php
4. Add this line of code. Am using psd (extension for photoshop files) as an example.
//Adding photoshop files
, 1, 1);
5. Note that the file extension of the file you want to add goes as the key in $mime_types associated array and the mime type as its value.
Alternatively, you can install a plugin such as WP Add Mime Types to do the heavy work for you.
1. Install and Activate WP Add Mime Types.
2. Go to the plugin’s Settings, then Mime Type Settings.
3. Add the entry for the file type you want to be supported. For example, use this line for android apk files:
apk = application/vnd.android.package-archive
4. Click save and you are good to go.
I hope this article has been helpful in eliminating the little stumbling block.
Please subscribe to receive email notifications of more informative articles.