wpseek.com
Outil de recherche WordPress pour les développeurs et auteurs de thèmes



wp_ext2type › WordPress Function

Depuis2.5.0
Dépréciéen/a
wp_ext2type ( $ext )
Paramètres:
  • (string) $ext The extension to search.
    Requis: Oui
Retourne:
  • (string|void) The file type, example: audio, video, document, spreadsheet, etc.
Défini(e) dans:
Codex:

Retrieves the file type based on the extension name.



Source

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;
		}
	}
}