Make WordPress Core

Opened 14 months ago

Last modified 14 months ago

#57879 new defect (bug)

fix rest_get_endpoint_args_for_schema() to allow user-defined sanitize and validate callbacks.

Reported by: mi5t4n's profile mi5t4n Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.7
Component: REST API Keywords: has-patch 2nd-opinion has-unit-tests
Focuses: rest-api Cc:


rest_get_endpoint_args_for_schema() doesn't allow user-defined validation and sanitize callbacks. It always uses rest_validate_request_arg and rest_sanitize_request_arg functions to validate and sanitize. This ticket fixes this.

Attachments (1)

0001-fix-allow-user-defined-validate-and-sanitize-callbac.patch (4.3 KB) - added by mi5t4n 14 months ago.

Download all attachments as: .zip

Change History (3)

#2 @hellofromTonya
14 months ago

  • Version changed from trunk to 4.7

Hello @mi5t4n,

Welcome to WordPress Core's Trac!

I'm modifying this ticket's Version from trunk to 4.7.0. Why? 4.7.0 is when the validation code was introduced in Core.

Some history:

  • In 4.7.0, [38832] / #38373 introduced WP_REST_Controller::get_endpoint_args_for_item_schema() which originally had the validation code within it.
  • In 5.6.0, [48951] / #50876 introduced rest_get_endpoint_args_for_schema() function and extracted the code from WP_REST_Controller::get_endpoint_args_for_item_schema() for it.

So 4.7.0 is when this code was introduced in Core.

Note: See TracTickets for help on using tickets.