функция
since 2.1.0
is_wp_error()
Проверено на WordPress 6.9, обновлено Источник: WordPress Developer Resources.
Сигнатура
is_wp_error( mixed $thing ): bool
Описание
Возвращает, является ли $thing экземпляром класса WP_Error.
Оригинал (английский)
Returns whether $thing is an instance of the WP_Error class.
Параметры
$thing
mixed
обязательный
Проверяемая переменная.
Возвращаемое значение
bool
WP_Error
Исходный код
wp-includes/load.php:1804
function is_wp_error( $thing ) {
$is_wp_error = ( $thing instanceof WP_Error );
if ( $is_wp_error ) {
/**
* Fires when `is_wp_error()` is called and its parameter is an instance of WP_Error.
*
* @since 5.6.0
*
* @param WP_Error $thing The error object passed to `is_wp_error()`.
*/
do_action( 'is_wp_error_instance', $thing );
}
return $is_wp_error;
}
История изменений
| Версия | Описание |
|---|---|
| 2.1.0 | Introduced. |

