If you got here, you noticed that WordPress doesn’t allow you to upload SVG files via the Media Library feature. At least not at this time.
Why you can’t upload SVG files in WordPress
It’s mostly because of security issues.
The SVG files contain XML code that can be used for various exploits. XML being similar to HTML when rendered, you might end-up with malicious code on your site if the SVG you added is not take from a secure source.
This is one (and maybe the most important) reason why WordPress doesn’t allow you to upload SVG files via the Media Library.
How to add SVG in WordPress with plugins
There are 2 easy ways to enable SVG upload in WordPress using a plugin.
This is perfect if you don’t need anything fancy and you just want to activate it and start uploading SVG files. There are no extra settings for this plugin. However, there is a premium version if this plugin in case you need more features: control over who has access to upload, inline SVGs (in case you want to have animated SVG files), and more.
The SVG files will be added like the images in your content. This is the one I go for when I need to have this option available, and I recommend it if you’re the one in control of the content that is being added on the site.
SVG Support is a complete solution that is free.
You can upload the SVG files like any other image, you will be able to render them like images or inline. There is an option for you to restrict access to specific user roles, this way you can make sure no one uploads any malicious SVG files to your site.
Between the 2 plugins presented, this is the better one since it has some of the features that are not available in Safe SVG.
If you don’t mind going and checking a few more options in the plugin settings and you need some more control, this is perfect for you.
No matter what option you choose, always be careful from where you take your SVG files before uploading them to the site. These plugins will not protect you from any malicious code that might be inserted in the files.