Check whether variable is a WordPress Error.

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

Signature

is_wp_error( $thing )
thing
 (mixed) Check if unknown variable is a WP_Error object.

Return

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

Source

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

Link here