X

Add support for SVG inside WordPress Media Uploader

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



Code Snippet:


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!