rest_convert_error_to_response


rest_convert_error_to_response ( $error )

Parameters:
  • (WP_Error) error WP_Error instance.
Returns:
  • (WP_REST_Response) List of associative arrays with code and message keys.
Defined at:

Description

Converts an error to a response object.This iterates over all error codes and messages to change it into a flat array. This enables simpler client behaviour, as it is represented as a list in JSON rather than an object/map.

Related Functions

rest_ensure_response, wp_convert_hr_to_bytes, convert_to_screen, wp_convert_bytes_to_hr, rest_get_route_for_post

Top Google Results

User discussions

wpseek mobile