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



get_available_post_mime_types ›

Since2.5.0
已弃用n/a
get_available_post_mime_types ( $type = 'attachment' )
参数:
  • (string) $type
    Required: No
    默认: 'attachment'
返回:
  • (mixed)
定义在:
文档:

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