Skip to content

Instantly share code, notes, and snippets.

@alexander-young
Created January 15, 2020 20:07
Show Gist options
  • Save alexander-young/fe022c86fb820984d67d014b58e8da83 to your computer and use it in GitHub Desktop.
Save alexander-young/fe022c86fb820984d67d014b58e8da83 to your computer and use it in GitHub Desktop.
Allow SVGs in WordPress media library
function upload_svg_files( $allowed ) {
if ( !current_user_can( 'manage_options' ) )
return $allowed;
$allowed['svg'] = 'image/svg+xml';
return $allowed;
}
add_filter( 'upload_mimes', 'upload_svg_files');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment