Allow SVG through WordPress Media Uploader
<!-- For your functions.php file or a functionality plugin: -->
function cc_mime_types($mimes) {
$mimes['svg'] = 'image/svg+xml';
return $mimes;
}
add_filter('upload_mimes', 'cc_mime_types');
<!-- Without this, SVG files will be rejected when attempting to upload them through the media uploader. -->
<!-- Before WordPress 4.0, you also make them display properly in the Media grid. But that's broken now. If anyone knows how to fix, let me know! -->
function fix_svg_thumb_display() {
echo '
td.media-icon img[src$=".svg"], img[src$=".svg"].attachment-post-thumbnail {
width: 100% !important;
height: auto !important;
}
';
}
add_action('admin_head', 'fix_svg_thumb_display');