WordPress support a number of image file types including .jpg, .jpeg, .png, and .gif . But it does not support SVG file format images to upload into the WordPress media by default .
So what if we need to upload the SVG images into the WordPress. For this what we have to do is to add a PHP file into the function.php.
The code used here is:
//add SVG to allowed file uploads
function my_custom_mime_types( $mimes ) {// New allowed mime types.
$mimes[‘svg’] = ‘image/svg+xml’;
$mimes[‘svgz’] = ‘image/svg+xml’;
$mimes[‘doc’] = ‘application/msword’;// Optional. Remove a mime type.
unset( $mimes[‘exe’] );return $mimes;
}
add_filter( ‘upload_mimes’, ‘my_custom_mime_types’ );
Make sure that this code is placed inside a php format.