REST API: Correctly parse body parameters for DELETE requests.

DELETE was inadvertently omitted from the list of non-POST HTTP methods that should be able to accept body parameters. Parameters passed to DELETE requests as JSON are already parsed correctly; this commit fixes application/x-www-form-urlencoded parameters as well.

Props mnelson4.
Merges [40105] to the 4.7 branch.
Fixes #39933.
Built from https://develop.svn.wordpress.org/branches/4.7@40113


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40050 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2017-02-24 20:56:34 +00:00
parent d95e0f8116
commit f980f4ca90
2 changed files with 2 additions and 2 deletions

View File

@ -364,7 +364,7 @@ class WP_REST_Request implements ArrayAccess {
$this->parse_body_params(); $this->parse_body_params();
} }
$accepts_body_data = array( 'POST', 'PUT', 'PATCH' ); $accepts_body_data = array( 'POST', 'PUT', 'PATCH', 'DELETE' );
if ( in_array( $this->method, $accepts_body_data ) ) { if ( in_array( $this->method, $accepts_body_data ) ) {
$order[] = 'POST'; $order[] = 'POST';
} }

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.7.3-alpha-40112'; $wp_version = '4.7.3-alpha-40113';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.