I really like SVG’s. I like to use them whenever I can. They are great for new devices and screens that have beautiful screens. Sure, they don’t get cached as easily as regular images but they have a lot to make up for it.

So, when I went to upload an SVG to my WordPress media library I was blocked. WordPress doesn’t let you upload SVG’s. I did some searching and found that you can add a bit of code to your function.php file to allow this. Just upload the code below and thats it.

function cc_mime_types($mimes) {
$mimes[‘svg’] = ‘image/svg+xml’;
return $mimes;
add_filter(‘upload_mimes’, ‘cc_mime_types’);

Do be careful uploading SVG’s that you find because malicious code may be inside of it.

Also, WordPress doesn’t have a preview for this once you upload it. I’m not sure how to get this activated at this time.