wiki:upload_additional_file_types_wordpress
Table of Contents
Upload additional file types in WordPress
This fixes the error “Sorry, This File Type Is Not Permitted for Security Reasons”.
In wp-config.php
add this:
define('ALLOW_UNFILTERED_UPLOADS', true);
If you are not using some custome theme but a Wordpress builder of some kind, edit the wp-includes/functions.php
. Otherwise go to your theme folder functions.php file (wp-content/themes/yourtheme/functions.php
. Add this to enable svg
upload:
// Allow additional MIME type upload function my_custom_mime_types( $mimes ) { // New allowed mime types. $mimes['svg'] = 'image/svg+xml'; $mimes['svgz'] = 'image/svg+xml'; // Optional. Remove a mime type. unset( $mimes['exe'] ); return $mimes; } add_filter( 'upload_mimes', 'my_custom_mime_types' );
These changes will most likely be overwritten on next theme or WP update.
Tested on
- WP 5.7
- PHP 7.3.27-1~deb10u1
See also
References
wiki/upload_additional_file_types_wordpress.txt · Last modified: 2021/03/23 11:27 by antisa