Do you want to enable SVG files support to your WordPress website? By default, WordPress allows you to upload all popular image, audio, and video file formats, but SVG is not among them. Since last few years, people have started using SVG on their projects, but they are worried about SVG support in WordPress.
Enabling SVG in WordPress is quite easy. You can enable SVG support by following ways.
1- Enable SVG Support using code:
You can do this just by adding the following code in theme’s functions.php file
function cc_mime_types($mimes) { $mimes['svg'] = 'image/svg+xml'; return $mimes; } add_filter('upload_mimes', 'cc_mime_types');
Adding This code will enable SVG support in your WordPress Website, but it has some security issues. There are chances that SVG, you are trying to upload is infected or SVG may have some malicious code in it.
2- Enable SVG support using the plugin:
You can do this by using a plugin. We recommend using Safe SVG plugin. This plugin will sanitize your SVG images before uploading to the library. This Plugin will also allow you to see uploaded SVG images in the media library.