--- a/wp/wp-includes/rest-api/class-wp-rest-request.php Fri Sep 05 18:40:08 2025 +0200
+++ b/wp/wp-includes/rest-api/class-wp-rest-request.php Fri Sep 05 18:52:52 2025 +0200
@@ -162,10 +162,22 @@
}
/**
+ * Determines if the request is the given method.
+ *
+ * @since 6.8.0
+ *
+ * @param string $method HTTP method.
+ * @return bool Whether the request is of the given method.
+ */
+ public function is_method( $method ) {
+ return $this->get_method() === strtoupper( $method );
+ }
+
+ /**
* Canonicalizes the header name.
*
* Ensures that header names are always treated the same regardless of
- * source. Header names are always case insensitive.
+ * source. Header names are always case-insensitive.
*
* Note that we treat `-` (dashes) and `_` (underscores) as the same
* character, as per header parsing rules in both Apache and nginx.
@@ -482,6 +494,11 @@
}
}
+ // Exclude rest_route if pretty permalinks are not enabled.
+ if ( ! get_option( 'permalink_structure' ) ) {
+ unset( $params['rest_route'] );
+ }
+
return $params;
}
@@ -709,7 +726,7 @@
* Parses the request body parameters.
*
* Parses out URL-encoded bodies for request methods that aren't supported
- * natively by PHP. In PHP 5.x, only POST has these parsed automatically.
+ * natively by PHP.
*
* @since 4.4.0
*/