is_wp_error() – Checks whether the given variable is a WordPress Error.
You appear to be a bot. Output may be restricted
Description
Checks whether the given variable is a WordPress Error.
Returns whether $thing
is an instance of the WP_Error
class.
Usage
$bool = is_wp_error( $thing );
Parameters
- $thing
- ( mixed ) required – The variable to check.
Returns
bool Whether the variable is an instance of WP_Error.
Source
File name: wordpress/wp-includes/load.php
Lines:
1 to 16 of 16
function is_wp_error( $thing ) { $is_wp_error = ( $thing instanceof WP_Error ); if ( $is_wp_error ) { /** * Fires when `is_wp_error()` is called and its parameter is an instance of `WP_Error`. * * @since 5.6.0 * * @param WP_Error $thing The error object passed to `is_wp_error()`. */ do_action( 'is_wp_error_instance', $thing ); } return $is_wp_error; }