Sorry, this file type is not permitted for security reasons WordPress

Tutorials 0 lượt xem

Sorry, this file type is not permitted for security reasons in WordPress is common. If you don’t know or encounter it for the first time, it will definitely be difficult. So how to fix this error easily? Read this article to find out how!

Supported file types by default

  • Images: jpg, jpeg, png, .gif, .ico
  • For documents: .pdf, .doc, .docx, .ppt, .pptx, .pps, .ppsx, .odt, .xls, .xlsx, .psd
  • Audio: .mp3, .m4a, .ogg, .wav
  • Video formats: .mp4, .m4v, .mov, .wmv, .avi, .mpg, .ogv, .3gp, .3g2

Currently there are many new formats such as .svg, .webp, .avif… So if you upload those that are not supported by WordPress, you will get an error Sorry, this file type is not permitted for security reasons.

Solutions

Method 1: Use the WP Extra File Types plugin

This one is relatively simple to install. You just need to go to cài đặt (Settings) => Extra File Types

Click on the MIME you want to add

WP-Extra-File-Types

Tip: Press Ctrl + F to type the keyword you want to find quickly. Example: .svg

In addition, you can also refer to other plugins such as: WP Add Mime Types, WP Media Type File Manager, MIME Types Plus.

Method 2: Use functions.php

Please add the following code to the functions.php file, if you want to change the format, change it

function custom_upload_mimes( $existing_mimes ) { 
// Thêm định dạng là webm
$existing_mimes['webm'] = 'video/webm';
return $existing_mimes;
}
add_filter( 'mime_types', 'custom_upload_mimes' );

Method 3: Use wp-config.php

Add the following code at the end of the file wp-config.php

define('ALLOW_UNFILTERED_UPLOADS', true);

Above are 3 ways to help fix the error Sorry, this file type is not permitted for security reasons. You can choose which one works best for you.

Conclusion: WordPress is a great source to build a website or blog. But if you are a newbie, you will have a lot of problems. Hopefully this article will help you save more time in finding errors.

Bài viết liên quan