REST API: Reverse order of setting sanitization/validation, validating prior to sanitizing.

Fixes mistake in the current behavior, where the sanitization callback ran before the validation callback. Now the validation callback will run before the sanitization.

Props schlessera, rachelbaker.
See #37247.
Fixes #37192.




git-svn-id: https://develop.svn.wordpress.org/trunk@37943 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Rachel Baker
2016-07-02 23:02:45 +00:00
parent c8ebbb3e0d
commit 855c081931
2 changed files with 47 additions and 2 deletions
@@ -853,8 +853,6 @@ class WP_REST_Server {
$request->set_url_params( $args );
$request->set_attributes( $handler );
$request->sanitize_params();
$defaults = array();
foreach ( $handler['args'] as $arg => $options ) {
@@ -869,6 +867,8 @@ class WP_REST_Server {
if ( is_wp_error( $check_required ) ) {
$response = $check_required;
}
$request->sanitize_params();
}
if ( ! is_wp_error( $response ) ) {