当前浏览:首页 / WordPress函数 / wp_attachment_is()

wp_attachment_is( string $type, int|WP_Post $post = null ): bool

验证附件是否为给定类型

attachment 附件more...

is 条件判断more...


参数

$typestring必填
附件类型。接受'image''audio''video'
$postint|WP_Post可选
附件ID或对象。默认值为全局$post。

默认:null


返回

bool 如果是接受的类型之一,则为true,否则为false。



源码

查看源码 官方文档


更新日志

版本描述
4.2.0开始引入