mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
Docs: Document the globals used in some REST API methods.
See #53399. git-svn-id: https://develop.svn.wordpress.org/trunk@51278 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -118,8 +118,8 @@ function register_rest_route( $namespace, $route, $args = array(), $override = f
|
||||
* @global array $wp_rest_additional_fields Holds registered fields, organized
|
||||
* by object type.
|
||||
*
|
||||
* @param string|array $object_type Object(s) the field is being registered
|
||||
* to, "post"|"term"|"comment" etc.
|
||||
* @param string|array $object_type Object(s) the field is being registered to,
|
||||
* "post"|"term"|"comment" etc.
|
||||
* @param string $attribute The attribute name.
|
||||
* @param array $args {
|
||||
* Optional. An array of arguments used to handle the registered field.
|
||||
@@ -135,6 +135,8 @@ function register_rest_route( $namespace, $route, $args = array(), $override = f
|
||||
* }
|
||||
*/
|
||||
function register_rest_field( $object_type, $attribute, $args = array() ) {
|
||||
global $wp_rest_additional_fields;
|
||||
|
||||
$defaults = array(
|
||||
'get_callback' => null,
|
||||
'update_callback' => null,
|
||||
@@ -143,8 +145,6 @@ function register_rest_field( $object_type, $attribute, $args = array() ) {
|
||||
|
||||
$args = wp_parse_args( $args, $defaults );
|
||||
|
||||
global $wp_rest_additional_fields;
|
||||
|
||||
$object_types = (array) $object_type;
|
||||
|
||||
foreach ( $object_types as $object_type ) {
|
||||
|
||||
Reference in New Issue
Block a user