确定附件是否为图像。
原型
wp_attachment_is_image( int|WP_Post $post = null )
描述
有关此功能和类似主题功能的更多信息,请查看Theme Developer Handbook中的Conditional Tags文章。
参数
$post
(int|WP_Post)
(Optional)
附件ID或对象。默认为全球$ post。
返回值
(bool)
附件是否是图像。
源文件
路径:wp-includes/post.php
<?php
...
function wp_attachment_is_image( $post = null ) {
return wp_attachment_is( 'image', $post );
}
...
?>
其他
英文文档:https://developer.wordpress.org/reference/functions/wp_attachment_is_image/