<?php
/*BUG Fix for after wordpress https://core.trac.wordpress.org/ticket/21299*/
add_filter( 'wp_check_filetype_and_ext', 'upload_mimes_fix_after_47', 10, 4 );
function upload_mimes_fix_after_47($data, $file, $filename, $mimes) {
global $wp_version;
if( $wp_version == '4.7' || ( (float) $wp_version < 4.7 ) ) { return $data; }
$filetype = wp_check_filetype( $filename, $mimes );
return [ 'ext' => $filetype['ext'], 'type' => $filetype['type'], 'proper_filename' => $data['proper_filename'] ];
}
/*add upload file type*/
add_filter('upload_mimes', 'custom_upload_mimes');
function custom_upload_mimes ( $existing_mimes=array() ) {
$existing_mimes['bz2'] = 'application/octet-stream';
return $existing_mimes;
}
?>