[wp-trac] [WordPress Trac] #37560: Enable sanitize_callback to return WP_Error

WordPress Trac noreply at wordpress.org
Wed Aug 3 21:58:47 UTC 2016


#37560: Enable sanitize_callback to return WP_Error
--------------------------+-----------------------------
 Reporter:  websupporter  |      Owner:
     Type:  enhancement   |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  REST API      |    Version:
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 As discussed in Slack, it might be helpful, if the sanitization callback
 could return a `WP_Error` object like the validation callback.

 https://wordpress.slack.com/archives/core-restapi/p1470200720000471

 This patch wants to get this done.

 With this patch, we would give developers the opportunity to reject
 incoming data without using the validation callback. It also enables us to
 do sanitization and validation in one function in instances where this
 could be useful.

 I've oriented the solution on how it is done in the validation callback:
 So, first all Errors are collected and then they will be returned. So if a
 request has more than one error, you get all the messages at once.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/37560>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list