is_wp_error
Check whether variable is a WordPress Error.
Description
is_wp_error( (mixed) $thing );
Returns true if $thing
is an object of the WP_Error
class.
Parameters (1)
- 0. $thing (mixed)
- Check if unknown variable is a
WP_Error
object.
Usage
if ( !function_exists( 'is_wp_error' ) ) { require_once ABSPATH . WPINC . '/load.php'; } // Check if unknown variable is a WP_Error object. $thing = null; // NOTICE! Understand what this does before running. $result = is_wp_error($thing);
Defined (1)
The function is defined in the following location(s).
- /wp-includes/load.php
- function is_wp_error( $thing ) {
- return ( $thing instanceof WP_Error );
- }