Advertisements

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

Advertisements

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: