WP_REST_Server::get_json_last_error() WordPress Method
The WP_REST_Server::get_json_last_error() function returns the last error that occurred during JSON decoding.
WP_REST_Server::get_json_last_error() #
Returns if an error occurred during most recent JSON encode/decode.
Description
Strings to be translated will be in format like "Encoding error: Maximum stack depth exceeded".
Return
(false|string) Boolean false or string error message.
Source
File: wp-includes/rest-api/class-wp-rest-server.php
protected function get_json_last_error() {
$last_error_code = json_last_error();
if ( JSON_ERROR_NONE === $last_error_code || empty( $last_error_code ) ) {
return false;
}
return json_last_error_msg();
}
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
| Version | Description |
|---|---|
| 4.4.0 | Introduced. |