Enable WordPress SVG Uploads to Media Library
In this article I will cover how to enable SVG uploads on your WordPress website quickly and easily using a free WordPress plugin.
As of this writing, SVG uploads are not permitted by the WordPress core for security (and for good reason). SVG files are basically XML files, which may include malicious code opening your WordPress website to attack. These include but may not be limited to XML external entity attacks (XXE), bomb nested entities (BNE) and Cross Site Scripting (XSS) attacks.
How to ‘Safely’ Enable WordPress SVG Uploads
I recommend the use of a handy and easy to use plugin called Safe SVG, formerly WP SVG. This plugin utilizes the SVG-Sanitizer library upon uploading SVG images to your WordPress media library. The plugin also enables you to view SVGs like normal images within the media library. After you install the Safe SVG plugin, there are no settings to adjust. Safe SVG will simply sanitize your SVG files upon upload.
An alternative and more advanced (in my opinion) WordPress plugin you might want to check out is SVG Support.
Regarding SVG Uploads
Before uploading your SVG file, it is important to understand that SVG files behave slightly differently than images. When exporting an SVG from your photo editing tool, you will want to export the text as curves (or create an outline), otherwise, it might render slightly different in various browsers.
On Uploading SVG Files to WordPress Media Library
The above plugins are not endorsed or supported by WordPress core, so use them at your own risk.
Also, if you have never used SVG files before, ensure that you have GZIP enabled on your server for the “image/svg+xml” file type. This will ensure that they are compressed which will result in faster load times even though they may already load quickly.
SVG files are a great way to enhance the look of your WordPress website! I recommend utilizing SVG, PNG, and JPG files together to achieve the best performance and aesthetic. Note that very detailed images may not perform as well in SVG format. SVG files are great for basic logo designs and icons which help to ensure that they look pixel-perfect on every screen.
Conclusion
I welcome your thoughts, questions or suggestions on my article on enabling SVG file Uploads within the WordPress Media Library.
You may support my work by sending me a tip using your Brave browser or by sending me a one time donation using your credit card.
Let me know if you found any errors within my article or if I may further assist you by answering any additional questions you may have.