'image/jpeg', 'gif' => 'image/gif', 'png' => 'image/png', 'bmp' => 'image/bmp', 'tif|tiff' => 'image/tiff', 'ico' => 'image/x-icon', ); // Allowed svg mime type in version 1.2.2. $allowed_mime = get_allowed_mime_types(); $svg_mime_check = isset($allowed_mime['svg']) ? true : false; if ($svg_mime_check) { $allow_mime = array('svg' => 'image/svg+xml'); $mimes = array_merge($mimes, $allow_mime); } // Return an array with file extension and mime_type. $file = wp_check_filetype($image, $mimes); // If $image has a valid mime_type, return it; otherwise, return the default. return esc_url_raw(($file['ext'] ? $image : $setting->default)); } }