WordPress开发者和主题制作者的搜索引擎



wp_ext2type ›

Since2.5.0
已弃用n/a
wp_ext2type ( $ext )
参数:
  • (string) $ext The extension to search.
    Required: Yes
返回:
  • (string|void) The file type, example: audio, video, document, spreadsheet, etc.
定义在:
文档:

Retrieve the file type based on the extension name.



源码

function wp_ext2type( $ext ) {
	$ext = strtolower( $ext );

	$ext2type = wp_get_ext_types();
	foreach ( $ext2type as $type => $exts ) {
		if ( in_array( $ext, $exts ) ) {
			return $type;
		}
	}
}