函数原型
get_available_post_mime_types( string $type = ‘attachment’ ): string[]
函数描述
Gets all available post MIME types for a given post type.
是否弃用
未弃用
函数参数
-
$type
string
Optional Default:
'attachment'
函数返回值
string[] An array of MIME types.
函数位置
File: wp-includes/post.php.
函数源码
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;
}
源码链接
变更日志
| Version | Description |
|---|---|
| 2.5.0 | Introduced. |

