get_available_post_mime_types() - WordPress 函数参考中文文档

返回介绍

get_available_post_mime_types()

发布于 2017-09-10 字数 1331 浏览 814 评论 0

get_available_post_mime_types( string $type = 'attachment' )

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


描述


参数

$type

(string)
(Optional)

Default value: ‘attachment’


返回值

(mixed)


源代码

File: wp-admin/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 描述
2.5.0 Introduced.

相关函数

Uses

  • wp-includes/wp-db.php:
    wpdb::get_col()
  • wp-includes/wp-db.php:
    wpdb::prepare()

Used By

  • wp-admin/includes/post.php:
    wp_edit_attachments_query()

User Contributed Notes

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

目前还没有任何评论,快来抢沙发吧!