“Sorry, this file type is not permitted for security reasons.”
The WordPress core developers have been discussing 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 plugin SVG Support, 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 and together with the above mentioned. With the plugin mentioned above, SVG upload should work then without further errors.
Keep in mind that cropping the image in WordPress will not work as SVGs will not, so if you’re asked to upload it, just skip this feature.
You have not worked with text files yet? Here’s how to edit plain text files.
Tip: pay attention to the correct file format
When to use SVG
On many websites, icons use fonts such as Font Awesome – but these are absolute PageSpeed killers.
Fonts are often loaded with high priority and icon fonts in particular have a comparatively high file size – even if you use only a few icons, all available icons are always transferred as a large file to the visitor of the website.
SVG files, on the other hand, can be played out modularly, i.e. only if they are actually part of the output.
SVG files are ideal for flat illustrations and now offer almost every level of detail – usually they are smaller in file size than pixel graphics such as PNG or JPG.
Never should you simply give e.B.JPG files the file .svg or embed pixel graphics in an SVG container – this only creates new problems and does not improve anything. In case of doubt, get support from an expert in optimizing your website media.