is_wp_error()
is_wp_error( mixed $thing )
检查变量是否为WordPress错误。
Check whether variable is a WordPress Error.
说明(Description)
如果$thing是WP_Error类的对象,则返回true。
参数(Parameters)
参数 | 类型 | 必填 | 说明 |
---|---|---|---|
$thing | (mixed) | 必需 | 检查未知变量是否为WP_Error对象。 |
返回(Return)
(bool)如果WP_错误,则为True。错误,如果不是WP_错误。
源码(Source)
is_wp_error() 函数的代码位于 wp-includes/class-wp-error.php.
更新版本 | 源码位置 | 使用 | 被使用 |
---|---|---|---|
2.1.0 | wp-includes/load.php:1417 | 407 | 0 |
笔记(Notes)
例子
WP_错误类:
wp_insert_用户示例
is_wp_error() 为WP2原创文章,链接:https://www.wp2.cn/functions/is_wp_error/