Wordprerss | Upload SVG or other files in Media Library

Author - Komal Dhiman

In WordPress, by default svg type of files are not permitted to upload.


So in order to upload the SVG files to WordPress media library, we will need to add following code to child theme’s functions.php file:

//To allow svg files uploading 

function allow_svg_upload_mimes($mimes = array()) {

// Add a key and value for the SVG file type

$mimes['svg'] = "text/svg";

return $mimes;


add_action('upload_mimes', 'allow_svg_upload_mimes');

Now, this code will allow the SVG file types to get uploaded to a media library.


Webner Solutions is a Software Development company focused on developing Insurance Agency Management Systems, Learning Management Systems and Salesforce apps. Contact us at dev@webners.com for your Insurance, eLearning and Salesforce applications.

Leave a Reply

Your email address will not be published.