User Tools

Site Tools


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:


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


wiki/upload_additional_file_types_wordpress.txt · Last modified: 2021/03/23 11:27 by antisa

Except where otherwise noted, content on this wiki is licensed under the following license: CC0 1.0 Universal
CC0 1.0 Universal Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki