is_wp_error

Check whether variable is a WordPress Error.

Description

is_wp_error( (mixed) $thing ); 

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 (1)

0. $thing (mixed)
Check if unknown variable is WordPress Error object.

Usage

  1. if ( !function_exists( 'is_wp_error' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-forums/bbpress/bb-includes/backpress/class.wp-error.php'; 
  3.  
  4. // Check if unknown variable is WordPress Error object. 
  5. $thing = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = is_wp_error($thing); 
  9.  

Defined (1)

The function is defined in the following location(s).

/bp-forums/bbpress/bb-includes/backpress/class.wp-error.php  
  1. function is_wp_error($thing) { 
  2. if ( is_object($thing) && is_a($thing, 'WP_Error') ) 
  3. return true; 
  4. return false;