scripts.mit.edu
/
autoinstalls
/
wordpress.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
WordPress 4.7.2
[autoinstalls/wordpress.git]
/
wp-includes
/
rest-api.php
diff --git
a/wp-includes/rest-api.php
b/wp-includes/rest-api.php
index e5efb74fbe42dc830f3fdb1514aab21ee84ca59a..5b62d96fce1058ac15c17ab7c270988ed880e032 100644
(file)
--- a/
wp-includes/rest-api.php
+++ b/
wp-includes/rest-api.php
@@
-46,6
+46,13
@@
function register_rest_route( $namespace, $route, $args = array(), $override = f
return false;
}
return false;
}
+ if ( isset( $args['args'] ) ) {
+ $common_args = $args['args'];
+ unset( $args['args'] );
+ } else {
+ $common_args = array();
+ }
+
if ( isset( $args['callback'] ) ) {
// Upgrade a single set to multiple.
$args = array( $args );
if ( isset( $args['callback'] ) ) {
// Upgrade a single set to multiple.
$args = array( $args );
@@
-57,12
+64,13
@@
function register_rest_route( $namespace, $route, $args = array(), $override = f
'args' => array(),
);
foreach ( $args as $key => &$arg_group ) {
'args' => array(),
);
foreach ( $args as $key => &$arg_group ) {
- if ( ! is_numeric( $
arg_group
) ) {
+ if ( ! is_numeric( $
key
) ) {
// Route option, skip here.
continue;
}
$arg_group = array_merge( $defaults, $arg_group );
// Route option, skip here.
continue;
}
$arg_group = array_merge( $defaults, $arg_group );
+ $arg_group['args'] = array_merge( $common_args, $arg_group['args'] );
}
$full_route = '/' . trim( $namespace, '/' ) . '/' . trim( $route, '/' );
}
$full_route = '/' . trim( $namespace, '/' ) . '/' . trim( $route, '/' );