How to add SVG upload support to your WordPress blog

Simply add the code below to functions.php in your WordPress theme. SVG upload will be supported once the file is saved.

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

Thanks to dbushell for the snippet!

Leave a Reply

Your email address will not be published. Required fields are marked *