----------------------------------------------- Paste the following code to function.php ----------------------------------------------- function enable_SVG( $mimes ) { if ( current_user_can( 'manage_options' ) ) { $mimes['svg'] = 'image/svg+xml'; } return $mimes; } add_filter( 'upload_mimes', 'enable_SVG' ); function enable_SVG_upload( $types, $file, $filename, $mimes ){ if( substr( $filename, -4 ) == '.svg' ){ $types['ext'] = 'svg'; $types['type'] = 'image/svg+xml'; } return $types; } add_filter( 'wp_check_filetype_and_ext', 'enable_SVG_upload', 10, 4 ); function enable_SVG_upload_idc( $response ) { if ( $response['mime'] === 'image/svg+xml' ) { $response['image'] = [ 'src' => $response['url'], ]; } return $response; } add_filter( 'wp_prepare_attachment_for_js', 'enable_SVG_upload_idc' );