function cc_mime_types($mimes) { $mimes['svg'] = 'image/svg+xml'; return $mimes; } add_filter('upload_mimes', 'cc_mime_types'); function ignore_upload_ext($checked, $file, $filename, $mimes){ //we only need to worry if WP failed the first pass if(!$checked['type']){ //rebuild the type info $wp_filetype = wp_check_filetype( $filename, $mimes ); $ext = $wp_filetype['ext']; $type = $wp_filetype['type']; $proper_filename = $filename; //preserve failure for non-svg images if($type && 0 === strpos($type, 'image/') && $ext !== 'svg'){ $ext = $type = false; } //everything else gets an OK, so e.g. we've disabled the error-prone finfo-related checks WP just went through. whether or not the upload will be allowed depends on the upload_mimes, etc. $checked = compact('ext','type','proper_filename'); } return $checked; } add_filter('wp_check_filetype_and_ext', 'ignore_upload_ext', 10, 4);