How To: Allows SVG in the Media Library

By default, WordPress only allows uploading certain types of images, depending on their extension (.jpg, .png, .gif, .jpeg and ico). If you would like to allow more file types (known as mime types), you can use the following code.

function meow_upload_mimes( $file_types ) {
  $new_filetypes = array();
  $new_filetypes['svg'] = 'image/svg';
  $file_types = array_merge( $file_types, $new_filetypes );
  return $file_types; 
} 
add_action( 'upload_mimes', 'meow_upload_mimes', 10, 1 );

You can add a line for each additional extension you would like, followed by its mime type. You can find a perfect list of mime types on the site of Mozilla.

If you don’t know how to add custom code to WordPress, please check the artile about Add Custom PHP Code to WordPress.