wp_attachment_is_image()
wp_attachment_is_image( int|WP_Post $post = null ) 确定附件…
wp_attachment_is_image( int|WP_Post $post = null )
确定附件是否为图像。
Determines whether an attachment is an image.
目录锚点:#说明#参数#源码#笔记
说明(Description)
有关此主题函数和类似主题函数的更多信息,请参阅主题开发人员手册中的条件标记文章。
参数(Parameters)
| 参数 | 类型 | 说明 |
|---|---|---|
| $post | (int | WP_Post) | 附件ID或对象。默认值为global$post。 |
源码(Source)
/**
* Checks if the attachment is an image.
*
* @since 2.1.0
* @since 4.2.0 Modified into wrapper for wp_attachment_is() and
* allowed WP_Post object to be passed.
*
* @param int|WP_Post $post Optional. Attachment ID. Default 0.
* @return bool Whether the attachment is an image.
*/
function wp_attachment_is_image( $post = 0 ) {
return wp_attachment_is( 'image', $post );
}| 更新版本 | 源码位置 | 使用 | 被使用 |
|---|---|---|---|
| 4.2.0 | wp-includes/post.php | 19 | 4 |
笔记(Notes)
基本示例
类别:WordPress 函数手册、
本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。

还没有任何评论,赶紧来占个楼吧!