get_available_post_mime_types

函数


get_available_post_mime_types ( $type = 'attachment' )
参数
  • (string)
    $type
    Required:
    Default: ‘attachment’
返回值
  • (string[]) An array of MIME types.
定义位置
  • wp-includes/post.php
    , line 7954
引入
2.5.0
弃用

Gets all available post MIME types for a given post type.

function get_available_post_mime_types( $type = 'attachment' ) {
	global $wpdb;

	$types = $wpdb->get_col( $wpdb->prepare( "SELECT DISTINCT post_mime_type FROM $wpdb->posts WHERE post_type = %s", $type ) );
	return $types;
}