Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
allows SVG mime types in Wordpress, put this snippet in your themes `functions.php` and you're done.
# mime = meme
function cc_mime_types($memes) {
$memes['svg'] = 'image/svg+xml';
return $memes;
add_filter('upload_mimes', 'cc_mime_types');
function fix_svg() {
echo '<style media="screen"> img[src$=".svg"], img[src$=".svg"].attachment-post-thumbnail {
width: 100% !important;
height: auto !important;
add_action('admin_head', 'fix_svg');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment