WP_REST_Response::is_error()
Checks if the response is an error, i.e. >= 400 response code.
Method of the class: WP_REST_Response{}
No Hooks.
Return
true|false
. Whether the response is an error.
Usage
$WP_REST_Response = new WP_REST_Response(); $WP_REST_Response->is_error();
Changelog
Since 4.4.0 | Introduced. |
WP_REST_Response::is_error() WP REST Response::is error code WP 6.6.2
public function is_error() { return $this->get_status() >= 400; }