Make WordPress Core

Opened 7 weeks ago

#43209 new enhancement

REST API should take settings errors into account

Reported by: flixos90 Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Options, Meta APIs Keywords: 2nd-opinion needs-patch
Focuses: rest-api Cc:


The WP_REST_Settings_Controller should notify the client when updating a setting fails due to an invalid value provided per the setting's sanitize_callback (should actually be validation, see related #43208). Currently this goes completely unnoticed.

While update_option() doesn't return any information like that, it may be possible to use the information passed to add_settings_error() in case of a validity issue, and forward that to the client by returning a WP_Error with the message.

Change History (0)

Note: See TracTickets for help on using tickets.