Skip to content

Instantly share code, notes, and snippets.

@bavington
Created January 11, 2014 13:39
Show Gist options
  • Save bavington/8371042 to your computer and use it in GitHub Desktop.
Save bavington/8371042 to your computer and use it in GitHub Desktop.
Allow the upload of SVG files into the WordPress Media Library by adding the following code to your theme's functions.php file.
<?php
/////////////////////////////////////////////////////////////////////////////////////
////////// Allow SVGs to be uploaded via the Media Centre within WordPress //////////
/////////////////////////////////////////////////////////////////////////////////////
function cc_mime_types( $mimes ){
$mimes['svg'] = 'image/svg+xml';
return $mimes;
}
add_filter( 'upload_mimes', 'cc_mime_types' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment