How To Support SVG File Type In WordPress Media Library?
SVG (Scalable Vector Graphics) is an XML-based vector image that is commonly used by websites and brands to display logos and icons on their websites. It creates images out of curves and allows for animations.
WordPress by default though doesn’t allow you to upload SVG file type into the media library for security reasons.
In this tutorial, I will show how you can upload SVG-type images into your media library using plugins or without plugins. Let’s do start…
1. Without Plugin: You just need to add the below code to your theme functions.php or your theme plugin.
// SVG Support function theme_domain_mime_types($mimes) { $mimes['svg'] = 'image/svg+xml'; return $mimes; } add_filter('upload_mimes', 'theme_domain_mime_types'); add_filter('mime_types', 'theme_domain_mime_types');

Go to Plugins » Add New inside your WordPress dashboard. Find the plugin by typing SVG Support.

Install and activate the plugin.
That’s it 👏👏
Happy coding. Thanks!