Skip to content

Instantly share code, notes, and snippets.

@johnjullies
Created September 20, 2017 05:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnjullies/93ecf3f1e5c9e5feba66b48b13bc38cb to your computer and use it in GitHub Desktop.
Save johnjullies/93ecf3f1e5c9e5feba66b48b13bc38cb to your computer and use it in GitHub Desktop.
svg support for Wordpress
/**
* SVG support
*/
function svg_mime_types( $mimes ) {
$mimes['svg'] = 'image/svg+xml';
return $mimes;}
add_filter( 'upload_mimes', 'svg_mime_types' );
function svg_size() {
echo '<style>
svg, img[src*=".svg"] {
max-width: 150px !important;
max-height: 150px !important;
}
</style>';
}
add_action('admin_head', 'svg_size');
/**
* end SVG support
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment