mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
REST API: Accept string path in rest_ensure_request.
Update `rest_ensure_request()` to accept a string path, permitting a string path to be passed to `rest_do_request()` as is indicated (previously inaccurately) in that method's PHPDoc. Props TimothyBlynJacobs, kadamwhite. Fixes #40614. Built from https://develop.svn.wordpress.org/trunk@46099 git-svn-id: http://core.svn.wordpress.org/trunk@45911 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
742ab2d68b
commit
c148f0aa55
@ -482,8 +482,9 @@ function rest_get_server() {
|
||||
* Ensures request arguments are a request object (for consistency).
|
||||
*
|
||||
* @since 4.4.0
|
||||
* @since 5.3.0 Accept string argument for the request path.
|
||||
*
|
||||
* @param array|WP_REST_Request $request Request to check.
|
||||
* @param array|string|WP_REST_Request $request Request to check.
|
||||
* @return WP_REST_Request REST request instance.
|
||||
*/
|
||||
function rest_ensure_request( $request ) {
|
||||
@ -491,6 +492,10 @@ function rest_ensure_request( $request ) {
|
||||
return $request;
|
||||
}
|
||||
|
||||
if ( is_string( $request ) ) {
|
||||
return new WP_REST_Request( 'GET', $request );
|
||||
}
|
||||
|
||||
return new WP_REST_Request( 'GET', '', $request );
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.3-alpha-46098';
|
||||
$wp_version = '5.3-alpha-46099';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user