Fixed: Sorry, this file type is not permitted for security reasons

The main reason behind this error in WordPress is more straightforward than it might seem. We can not know it, but WordPress has restrictions on the some types of files we can upload. The error "Sorry, this file type is not permitted for security reasons."  appears when we try to upload a prohibited file type like .svg, .svgz, .docs etc.

We can fix this issue using following methods:

1. Modify file types using a Plugin: There are several plugins capable of enabling you to upload prohibited file types, such as File Manager and Enhanced Media Library.

2. Use the upload_mimes filter by editing theme's functions.php file and paste below code:
function av_custom_mime_types( $mimes ) {
// Add new new allowed mime types
$mimes['doc'] = 'application/msword';
$mimes['svg'] = 'image/svg+xml';
$mimes['svgz'] = 'image/svg+xml';

// You can remove any particular mime type (Optional)
unset( $mimes['exe'] );

return $mimes;
}
add_filter( 'upload_mimes', 'av_custom_mime_types' );

Comments

Popular posts from this blog

Creating Protected routes in ReactJS

Redirect http to https in codeigniter