-
Notifications
You must be signed in to change notification settings - Fork 2
Home
Slava Abakumov edited this page Feb 15, 2023
·
2 revisions
Welcome to the file-upload-types wiki!
The plugin has a filter file_upload_types_strict_check
to override the stricter mime type check since WordPress 5.0.1 where the file content and file extension must match.
Use Case Examples:
1. Avoid strict check for .asc extension.
add_filter( 'file_upload_types_strict_check', static function ( $bool, $ext ) {
return $ext !== 'asc';
}, 10, 2 );
2. Avoid strict check for an array of extensions.
add_filter( 'file_upload_types_strict_check', static function ( $bool, $ext ) {
return ! in_array( $ext, [ 'asc', 'woff', 'ogg', 'webp' ] );
}, 10, 2 );
3. Avoid strict check for all extensions.
add_filter( 'file_upload_types_strict_check', '__return_false' );
** Please note that disabling strict checks can potentially be misused.