1. 首页
  2. WordPress 函数手册

has_image_size()

has_image_size( string $name )

检查图像大小是否存在。
Check if an image size exists.

目录锚点:#参数#返回#源码#笔记


参数(Parameters)

参数 类型 必填 说明
$name (string) 必需 要检查的图像大小。

返回(Return)

(bool)如果图像大小存在,则为True;如果不存在,则为false。


源码(Source)


更新版本 源码位置 使用 被使用
3.9.0 wp-includes/media.php:310 0 1 function

笔记(Notes)

此函数仅检查通过add_image_size()函数注册的图像大小,不考虑核心图像大小,即small、medium、medium_large和large。因此,使用has_image_size()检查核心图像大小将始终返回FALSE。

has_image_size() 为WP2原创文章,链接:https://www.wp2.cn/functions/has_image_size/