Post On : January 18, 2020

Hello developers,  

Today, I am going to show you how to svg file upload in wordpress media library. svg format does not support in wordpress media library. You can see in below screenshot

Here is a code that allows svg upload in media library. Put it in functions.php file.   

function cc_mime_types($mimes) {
$mimes['svg'] = 'image/svg+xml';
return $mimes;
} 
add_filter('upload_mimes', 'cc_mime_types'); 

Put below code in wp-config.php file.

define('ALLOW_UNFILTERED_UPLOADS', true); 

Now, we allows svg format files upload in media library. you can see in below screenshot. 

Hopefully this article is useful for you.

Thank You 🙂

Catagory :Wordpress