Add support for SVG inside WordPress Media Uploader

Adding this snippet to the functions.php file of your WordPress theme will add support for uploading SVG files inside the Wordpress Media Uploader. It is important to consider the risks when uploading SVG files, as they are XML files. Keep security in mind and don't allow just anyone to upload SVG files. You also may want to consider running the Scalable Vector Graphics (SVG) plugin if you have any concerns.

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

Comments  Leave a Reply

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!