W3cubDocs

/WordPress

is_wp_error( mixed $thing )

Check whether variable is a WordPress Error.

Description

Returns true if $thing is an object of the WP_Error class.

Parameters

$thing

(mixed) (Required) Check if unknown variable is a WP_Error object.

Return

(bool) True, if WP_Error. False, if not WP_Error.

Source

File: wp-includes/load.php

function is_wp_error( $thing ) {
	return ( $thing instanceof WP_Error );
}

Changelog

Version Description
2.1.0 Introduced.

© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/is_wp_error