is_wp_error

Definition:
function is_wp_error($thing) {}

Check whether variable is a WordPress Error.
Looks at the object and if a WP_Error class. Does not check to see if the parent is also WP_Error, so can’t inherit WP_Error and still use this function.

Parameters

  • mixed $thing: Check if unknown variable is WordPress Error object.

Return values

returns:True, if WP_Error. False, if not WP_Error.

Source code

function is_wp_error($thing) {

	if ( is_object($thing) && is_a($thing, 'WP_Error') )

		return true;

	return false;

}

9944

No comments yet... Be the first to leave a reply!

Leave a comment