The WordPress core developers have been debating the right way to handle SVG files for years – the background is security concerns, as it’s a file format that could allow authors to inject malicious code into WordPress through media uploading – and not just admins.
Therefore, WordPress does not allow SVG files to be uploaded to WordPress. For years, we have been using the SVG Support plugin, which we have already financially supported.
But since version 5 of WordPress, the SVG files must contain an extra line of code to be uploaded:
<?xml version="1.0" encoding="utf-8"?>
Insert this line at the beginning of your SVG file with a text editor. Together with the plugin mentioned above the SVG upload should work then without further errors.
Keep in mind that cropping the image in WordPress will not work because it’s not possible with SVGs – if you’re asked to upload it, just skip this feature.