Disable Php in Themes Blocking Media Uploads
February 09, 2022
Hasna A.
6min Read
How to Set "Sorry, This File Type Is Not Permitted for Security Reasons" WordPress Error
When uploading a file to your WordPress media library, you might come across the "Deplorable, this file type is not permitted for security reasons" error.
Fifty-fifty though this is a common error message, receiving it can be frustrating – especially if you're sure that the file you're trying to upload is non a threat to your WordPress site security.
Download WordPress Cheat Canvass
Fortunately, the "Pitiful, this file type is not permitted for security reasons" error is solvable. This commodity will explain why this fault bulletin appears and how to fix it in five dissimilar ways.
Why Does The "Sorry, This File Type Is Not Permitted for Security Reasons" Error Occur?
WordPress permits users to upload images, documents, sound, and video in these popular file types:
- Images: .jpeg, .jpg, .png, .gif, .ico
- Documents: .pdf, .doc, .docx, .ppt, .pptx, .pps, .ppsx, .odt, .xls, .xlsx, .psd
- Audio: .mp3, .m4a, .ogg, .wav
- Video: .mp4, .m4v, .mov, .wmv, .avi, .mpg, .ogv, .3gp, .3g2
Any file outside the permitted file types tin't exist uploaded to the media library by default. Y'all volition get the "Sorry, this file type is not permitted for security reasons" mistake in WordPress when you attempt to upload them.
For example, you lot can't upload a .epub or a .woff file without making some configurations kickoff.

Merely allowing certain file types minimizes the risks of a security breach due to potentially malicious files.
If you lot're not careful, such dangerous files tin make their way into your WordPress site – whether accidentally or purposefully – and expose your site's vulnerabilities. This can harm your site or give hackers admission to your sensitive data.
Fixing "Sorry, This File Type Is Not Permitted for Security Reasons" Fault
Although WordPress' reason behind limiting file types is well-intentioned, it poses a problem for users who desire to share specific files on their website.
In this section, nosotros'll explain 5 different ways to fix the "Lamentable, this file blazon is not permitted for security reasons" error in WordPress.
i. Double-Checking the File Type
In some cases, the file you want to upload falls within WordPress' list of permitted file types, all the same you still get the "Sorry, this file blazon is not permitted for security reasons" error.
It's possible that the file name extension was misspelled or accidentally changed, making the file unrecognizable to WordPress. So before trying any other method, make sure that the file extension is correct.

If you're using Windows, go to the location of your file on Windows Explorer. From the menu, select the View tab and check File name extensions.
Now you lot tin can view and edit the extension of all files. For example, if you observe that the file'south extension is misspelled, right-click on the file and Rename it to the right one.

The process is like if you're using a Mac – you'll need to head to Finder -> Preferences -> Avant-garde and enable Show all filename extensions.
If the file type is permitted past WordPress, re-uploading it with the correct extension should solve the "Distressing, this file type is not permitted for security reasons" mistake message. However, if the file extension is correctly spelled and isn't permitted by WordPress, endeavour the other methods.
2. Using a WordPress Plugin
WordPress has plenty of WordPress plugins that can help you upload unsupported file types. These plugins let yous enable many Multipurpose Cyberspace Mail Extensions (MIME) types disabled past the media library.
This step-by-step tutorial volition show yous how to fix the "Pitiful, this file type is not permitted for security reasons" error using the free plugin WP Add Mime Types.
- From the WordPress admin area, install the plugin and actuate information technology.
- Navigate to Settings -> Mime Blazon Settings.
- In the Add together Values section, enter the right MIME type value for the file y'all want to add. For example, if you're going to upload a .woff file, enter
woff = application/ten-font-woff
. To add multiple MIME file types, separate each value with Enter.

- Click Save. If the process is successful, the new MIME type should announced in the permitted list, and you'll be able to re-upload the file with no issue.

3. Editing wp-config.php File
Editing your site's wp-config.php file tin can let yous to upload all file types to the media library, including unsupported ones. All the same, keep in mind that this method will make your WordPress website less secure.
We suggest yous to revert any changes made in one case y'all have uploaded the unsupported file.
Also, because yous'll be editing a system file, brand sure to create a backup of your site before proceeding in case something goes wrong.
- Access your WordPress installation directory via an FTP client or File Manager. If you apply Hostinger, open hPanel and navigate to Files -> File Managing director.

- Open the public_html folder and open up the wp-config.php file.

- Paste the following code snippet above the line that says That's all, stop editing! Happy publishing. Then, Save your changes.
define('ALLOW_UNFILTERED_UPLOADS', true);

4. Editing the Theme'southward functions.php File
If the wp-config.php file method feels too risky, adding the upload_mimes filter to your theme's functions.php file might be a better alternative. This method enables certain file types individually instead of all of them simultaneously. Upon backing up your site, follow these steps:
- Access your WordPress installation directory via an FTP client or File Manager.
- Navigate to wp-content -> themes, access your current theme's binder and open the functions.php file.

- Paste the post-obit syntax in the file. Feel free to add your desired MIME types under the // Add new MIME types here line. Save the changes.
function my_custom_mime_types( $mimes ) {
// Add new MIME types here
$mimes['gpx'] = 'text/gpsxml';
return $mimes;
}

Keep in mind that different operating systems employ different versions of a similar file type, making their MIME values every bit different.
For example, .gpx files on Windows are .gpsxml on macOS. And so, instead of $mimes['gpx'] = 'text/gpsxml';
add together $mimes['gpx'] = 'application/gpsxml';
on macOS.
5. Contacting Your Hosting Provider
Sometimes WordPress isn't the simply thing stopping yous from uploading specific files. Several hosting providers enact file type restrictions to ensure security.
And so, if none of the methods nosotros have offered are working, contact your hosting provider'south support team and ask them to fix the upshot.
If you lot use Hostinger, feel free to contact our client success squad via live conversation. Open up hPanel and go to Help -> Contact us.

A alive conversation window will appear. Send a message, and you volition soon be in touch with one of our customer success agents.
Additional MIME WordPress Plugins
In addition to WP Add Mime Types, other plugin alternatives will aid you lot resolve the "Sorry, this file type is not permitted for security reasons" error message as it lets you upload unsupported MIME file types to WordPress.
However, you should simply install one MIME plugin at a time to avert alien errors.
1. Media Library Assistant

Plugin Stats:
- Downloads: 70,000+
- Rating: 5/five
- Notable features: MIME types management, zipper metadata custom fields, enhanced search media box.
- All-time suited for: people looking for a highly customizable media library plugin.
- Price: free
Media Library Banana is a customizable plugin that adds a ton of features to the media library. These include managing MIME types, calculation custom fields for attachment metadata, and adding specific filters to media library searches.
To add unpermitted file types, enable the MIME types present in the plugin's settings or add custom ones.
The significant reward of this plugin is its extensive customization options. Users can set the interface and functionality of the WordPress media library to their preference.
While the affluence of options can exist overwhelming for some, if customization is essential, this plugin is an excellent choice.
DOWNLOAD
2. Enhanced Media Library

Plugin Stats:
- Downloads: 100,000+
- Rating: four.five/5
- Notable features: MIME types, image size, and image taxonomies management
- Best suited for: people looking for a media library plugin with a uncomplicated interface
- Price: freemium
Enhanced Media Library is an piece of cake-to-use plugin to add and edit MIME types, adjust paradigm sizes, and manage image taxonomies in your media library.
To add together MIME types, simply go to the plugin's settings and check Allow Upload next to the MIME types you want to enable in the media library. If the MIME type yous want doesn't appear in the list, feel complimentary to add together custom ones, besides.
Suppose y'all desire more features like unlimited media categories/tags and avant-garde media library search filters. In that case, there'southward a premium version of the plugin that costs $25 for a lifetime license and supports WordPress multisite.
DOWNLOAD
3. File Upload Types

Plugin Stats:
- Downloads: 8,000+
- Rating: 5/5
- Notable features: MIME types direction
- Best suited for: those looking for a plugin for MIME types management but
- Price: free
File Upload Types is a plugin for enabling file types outside of WordPress's whitelist. Fifty-fifty though it lacks additional features, information technology'due south sufficient for those that just want to manage allowed MIME types on their WordPress media library.
Upon installation and activation, allow a particular file type to navigate the plugins' settings and check the box next to a file type tabular array. If you can't notice the file type you're looking for, add a custom file type in the provided fields.
DOWNLOAD
Conclusion
The "Lamentable, this file type is not permitted for security reasons" mistake bulletin will appear if you try to upload file types that WordPress doesn't permit past default.
Even though this is a well-pregnant restriction, information technology makes information technology a problem for users who want to share the files they desire.
In this guide, we've explained v different workarounds for this mistake:
- Double-checking the file type
- Using a WordPress plugin
- Editing wp-config.php file
- Editing the theme'due south functions.php file
- Contacting your hosting provider
No affair which method yous choose, nosotros hope that this article helped you resolve the "Sorry, this file blazon is not permitted for security reasons" fault message in WordPress.
galliherthantly62.blogspot.com
Source: https://www.hostinger.com/tutorials/fix-sorry-this-file-type-is-not-permitted-for-security-reasons-error-in-wordpress
0 Response to "Disable Php in Themes Blocking Media Uploads"
Post a Comment