Note the stricter mime type check since WP 5.0.1 where the file content and file extension must match. See e.g. this recent question on the vtt file type.
Secondary mime type for a given file extension
Here's a suggestion how to support a secondary mime type for a given file extension. Let's take .vtt as an example. The core assumes the mime type of text/vtt for that file extension, but the real mime type from finfo_file() can sometimes be text/plain. The finfo_file() seems to be somewhat buggy. We can add a support for it as a secondary mime type with:
add_filter( 'wp_check_filetype_and_ext', 'wpse323750_secondary_mime', 99, 4 );
function wpse323750_secondary_mime( $check, $file, $filename, $mimes ) {
if ( empty( $check['ext'] ) && empty( $check['type'] ) ) {
$secondary_mime = [ 'vtt' => 'text/plain' ];
remove_filter( 'wp_check_filetype_and_ext', 'wpse323750_secondary_mime', 99, 4 );
$check = wp_check_filetype_and_ext( $file, $filename, $secondary_mime );
add_filter( 'wp_check_filetype_and_ext', 'wpse323750_secondary_mime', 99, 4 );
}
return $check;
}
Here we use the wp_check_filetype_and_ext filter to see if the check failed. In that case we run wp_check_filetype_and_ext() again but now only on our secondary mime type, disabling our filter callback in the meanwhile to avoid an infinite loop.
Multiple mime types for a given file extension
If we need to support more than two mime types for the .vtt files, then we can expand the above snippet with:
add_filter( 'wp_check_filetype_and_ext', 'wpse323750_multi_mimes', 99, 4 );
function wpse323750_multi_mimes( $check, $file, $filename, $mimes ) {
if ( empty( $check['ext'] ) && empty( $check['type'] ) ) {
$multi_mimes = [ [ 'vtt' => 'text/foo' ], [ 'vtt' => 'text/bar' ] ];
foreach( $multi_mimes as $mime ) {
remove_filter( 'wp_check_filetype_and_ext', 'wpse323750_multi_mimes', 99, 4 );
$check = wp_check_filetype_and_ext( $file, $filename, $mime );
add_filter( 'wp_check_filetype_and_ext', 'wpse323750_multi_mimes', 99, 4 );
if ( ! empty( $check['ext'] ) || ! empty( $check['type'] ) ) {
return $check;
}
}
}
return $check;
}
I hope you can test it further and adjust it to your needs.