Uses
| Uses | Description |
|---|---|
| wp-includes/functions.php: wp_get_ext_types() | Retrieves the list of common file extensions and their types. |
Retrieve the file type based on the extension name.
(string) (Required) The extension to search.
(string|void) The file type, example: audio, video, document, spreadsheet, etc.
File: wp-includes/functions.php
function wp_ext2type( $ext ) {
$ext = strtolower( $ext );
$ext2type = wp_get_ext_types();
foreach ( $ext2type as $type => $exts ) {
if ( in_array( $ext, $exts, true ) ) {
return $type;
}
}
} | Version | Description |
|---|---|
| 2.5.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/wp_ext2type