apply_filters( 'wp_check_filetype_and_ext', array $wp_check_filetype_and_ext, string $file, string $filename, string[]|null $mimes, string|false $real_mime )
- Since
- 3.0.0, 5.1.0
Filters the "real" file type of the given file.
Compatibility
- WordPress
- since 5.1.0
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0).
Parameters
$wp_check_filetype_and_extarray- { Values for the extension, mime type, and corrected filename.
@type string|false $ext File extension, or false if the file doesn't match a mime type.
@type string|false $type File mime type, or false if the file doesn't match a mime type.
@type string|false $proper_filename File name with its correct extension, or false if it cannot be determined.
}$extstring|falseFile extension, or false if the file doesn't match a mime type.$typestring|falseFile mime type, or false if the file doesn't match a mime type.$proper_filenamestring|falseFile name with its correct extension, or false if it cannot be determined.
$filestring- Full path to the file.
$filenamestring- The name of the file (may differ from $file due to $file being in a tmp directory).
$mimesstring[]|null- Array of mime types keyed by their file extension regex, or null if none were provided.
$real_mimestring|false- The actual mime type or false if the type cannot be determined.
Where this hook fires · 1
wp-includes/functions.php:3352wp_check_filetype_and_ext()
Source code
* @param string $filename The name of the file (may differ from $file due to * $file being in a tmp directory). * @param string[]|null $mimes Array of mime types keyed by their file extension regex, or null if * none were provided. * @param string|false $real_mime The actual mime type or false if the type cannot be determined. */ return apply_filters( 'wp_check_filetype_and_ext', compact( 'ext', 'type', 'proper_filename' ), $file, $filename, $mimes, $real_mime );} /** * Returns the real mime type of an image file. * * This depends on exif_imagetype() or getimagesize() to determine real mime types.Changelog
Introduced in 3.0.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
5.1.0
The
$real_mime parameter was added.from the docblock3.0.0
Introduced.from the docblock
About this page
- Parsed data
- Generated from the wordpress-develop 7.1.0 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
- Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.