While direct insertion of .SVG code into the HTML block will work just fine, getting a .SVG file into the media library is a different thing. By default WordPress does not allow .SVG upload – mainly because the format being code based could contain malicious scripts.
This block of code in a theme’s function file would grant .SVG upload permission
//add SVG to allowed file uploads
function add_file_types_to_uploads($file_types){
$new_filetypes = array();
$new_filetypes['svg'] = 'image/svg+xml';
$file_types = array_merge($file_types, $new_filetypes );
return $file_types;
}
add_action('upload_mimes', 'add_file_types_to_uploads');
There are several plugins on the repository that achieve the same end here are the top two:
Both of these plugins will sanitize any uploaded .SVG file before allowing it into the media folder.