To upload SVG to WordPress websites, you need to allow this file type. Otherwise, the WordPress media library will not accept SVG files by default.
SVG is a vector file and may have security issues if you have not downloaded it from a trusted source. Without this specific file permission, you may get an error while trying to upload SVG to WordPress Media Library: “Sorry, this file type is not permitted for security reasons.”
In this post, I will show you how to upload SVG to WordPress. Also, I will help you to troubleshoot if you still have any issues after following this guideline.
How to upload SVG files to the WordPress website?
There are a couple of ways to allow SVG file type in the WordPress media library. Such as writing code to your “functions.php”, using plugins, etc. But in this post, I will only show you how to accomplish this using a plugin.
Use any one of the two following plugins to upload SVG to your WordPress website.
SVG Support by Benbodhi
It’s a free plugin in the WordPress repository. There is nothing crazy settings in this plugin. Just install & activate, and you will be able to upload SVG files to your WordPress site.
If you don’t know, learn how to install a WordPress plugin.
Are you still struggling to upload SVG files even after activating the WordPress SVG Support plugin? See the next section to make it work differently.
As mentioned earlier, you can upload SVG files without any additional settings. However, I suggest you enable one option.
It’s “Restrict to Administrators” and enabling this option will only allow the administrators to upload SVG files.
You will find this option in Settings => SVG Support. See the screenshot below for more clarifications.
Otherwise, everyone will be able to upload SVG files to your WordPress media library. For example- Editor, Author, etc. But if it’s okay for you, then leave this setting as it is.
This plugin has 500,000+ active installations and great reviews. It’s a very lightweight plugin and it has no impact on your website loading time/speed.
Troubleshoot: WordPress SVG support not working [Do it differently]
Still not able to upload SVG files? See the video instructions below for more help.
If you see the WordPress SVG support plugin still not working and if you’re unable to insert SVG files even after activating the plugin, then navigate to “Media » Add New” and upload the SVG files. And then go back to your post or pages and select the file that you want.
This is just because sometimes your current setup may not allow uploading SVGs direct from the post or page.
So if the SVG support plugin is not working as expected in your WordPress installation, then follow the above method in order to make it work.
Safe SVG by 10up (alternative option)
Currently, this plugin is not maintained by the developer and also he has not updated the plugin for the last 2 years (2022). But it still works.
If you already have tried the first plugin and failed to make it work, you may give it a try.
It’s another plugin that will help you to upload SVG files and sanitize XML vulnerabilities.
This plugin does not require any setup or configuration. Just plug & play.
It has more than 400,000 active installations with good reviews.
FAQ & Troubleshoot
If you’re not able to upload SVG files after activating the “SVG Support” plugin, do the following:
Navigate to the “Media » Library » Add New” and upload your file.
Once it has been uploaded to the media library, go to edit any post or page and now you will be able to insert the SVG files. For more clarifications, see the video instructions above (middle of the page).
Because of security reasons. Since the SVG file contains scripts (XML code), so there is a chance to inject bad code. And by using an insecure SVG file, your website will have vulnerabilities.
This is the reason for WordPress is not allowing SVG file upload by default.
It’s totally normal to use SVGs if you created them yourself or if you downloaded them from a trusted source.
In my opinion & based on practical use cases, I found the “SVG Support” very handy.
However, I mentioned two WordPress plugins for SVG upload. There are other plugins but I found these two very useful. Especially these two plugins don’t need any critical configuration or manual work.
SVG stands for Scalable Vector Graphics. It is very small in file size but too much crisp & clear. And even it does not become blurry in large screen sizes.
SVG file loads very fast compared to JPG & PNG. These are the main reasons people like SVGs.
SVG files are vector-based.
On the other hand, JPG & PNG files are pixel-based.
For example- you can think of the difference between Adobe Illustrator & Photoshop.
SVG is a specific type of file that contains code (XML) and this could be the cause of vulnerabilities in some cases.
Sanitizing the SVG files or making your site secure is more important than learning how to upload SVG files to the WordPress website. And in this post, I introduced two plugins that can handle these sanitizations.
I personally tested these two plugins many times before writing this recommendation/post. And never found any issues. You can follow my guideline to upload SVG to WordPress website without any doubt.