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



wp_ext2type › WordPress Function

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

Retrieves the file type based on the extension name.



源码

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

	$ext2type = wp_get_ext_types();

	return array_find_key(
		$ext2type,
		fn( $exts ) => in_array( $ext, $exts, true )
	);
}