wp_attachment_is_image

函数
wp_attachment_is_image ( $post = null )
参数
  • (int|WP_Post) $post Optional. Attachment ID or object. Default is global $post.
    Required:
    Default: null
返回值
  • (bool) Whether the attachment is an image.
定义位置
相关方法
wp_get_attachment_imagewp_attachment_iswp_get_attachment_image_urlwp_get_attachment_image_srcwp_get_attachment_image_sizes
引入
2.1.0
弃用
-

wp_attachment_is_image: 这是一个条件标签,用于检查给定的附件是否是图像。如果附件是图像,它返回true,否则返回false。

确定一个附件是否是一个图片。

关于这个和类似的主题功能的更多信息,请查看《主题开发者手册》中的{@link Conditional Tags}文章。

function wp_attachment_is_image( $post = null ) {
	return wp_attachment_is( 'image', $post );
}

常见问题

FAQs
查看更多 >
闪电侠

(工作日 10:00 - 18:30 为您服务)

2026-03-15 16:37:22

您好,无论是售前、售后、意见建议……均可通过联系工单与我们取得联系。

您也可选择聊天工具与我们即时沟通或点击查看:

您的工单我们已经收到,我们将会尽快跟您联系!
取消
选择聊天工具: