wp_ext2type() – Retrieve the file type based on the extension name.

You appear to be a bot. Output may be restricted

Description

Retrieves the file type based on the extension name.

Usage

$string|void = wp_ext2type( $ext );

Parameters

$ext
( string ) required – The extension to search.

Returns

string|void The file type, example: audio, video, document, spreadsheet, etc.

Source

File name: wordpress/wp-includes/functions.php
Lines:

1 to 10 of 10
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;
    }
  }
}
 

 View on GitHub View on Trac