From d10a54f83c94daf6f3dfcac4260a658e0b29b58d Mon Sep 17 00:00:00 2001 From: Drew Jaynes Date: Sun, 30 Oct 2016 17:41:15 +0000 Subject: [PATCH] REST: Fix a yoda condition in `WP_REST_Request::get_parameter_order()` and add a missing period for an inline comment in `WP_REST_Request::from_url(). Props mrahmadawais. See #38398. git-svn-id: https://develop.svn.wordpress.org/trunk@39027 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/rest-api/class-wp-rest-request.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/rest-api/class-wp-rest-request.php b/src/wp-includes/rest-api/class-wp-rest-request.php index 15c4728941..9c5410a0ec 100644 --- a/src/wp-includes/rest-api/class-wp-rest-request.php +++ b/src/wp-includes/rest-api/class-wp-rest-request.php @@ -359,7 +359,8 @@ class WP_REST_Request implements ArrayAccess { // Ensure we parse the body data. $body = $this->get_body(); - if ( $this->method !== 'POST' && ! empty( $body ) ) { + + if ( 'POST' !== $this->method && ! empty( $body ) ) { $this->parse_body_params(); } @@ -967,7 +968,7 @@ class WP_REST_Request implements ArrayAccess { $api_root = rest_url(); if ( get_option( 'permalink_structure' ) && 0 === strpos( $url, $api_root ) ) { - // Pretty permalinks on, and URL is under the API root + // Pretty permalinks on, and URL is under the API root. $api_url_part = substr( $url, strlen( untrailingslashit( $api_root ) ) ); $route = parse_url( $api_url_part, PHP_URL_PATH ); } elseif ( ! empty( $query_params['rest_route'] ) ) {