WordPress.org

Make WordPress Core


Ignore:
Timestamp:
08/15/2019 08:03:18 PM (2 months ago)
Author:
kadamwhite
Message:

REST API: Clarify arguments passed to rest route get & update callbacks.

Update doc block argument definitions to clarify that the REST API always passes an array to the get_callback and always passes an entity object to the update_callback.

Props TimothyBlynJacobs, salzano.
Fixes #44432.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api.php

    r45807 r45810  
    103103 *     Optional. An array of arguments used to handle the registered field.
    104104 *
    105  *     @type string|array|null $get_callback    Optional. The callback function used to retrieve the field
    106  *                                              value. Default is 'null', the field will not be returned in
    107  *                                              the response.
    108  *     @type string|array|null $update_callback Optional. The callback function used to set and update the
    109  *                                              field value. Default is 'null', the value cannot be set or
    110  *                                              updated.
    111  *     @type string|array|null $schema          Optional. The callback function used to create the schema for
    112  *                                              this field. Default is 'null', no schema entry will be returned.
     105 *     @type callable|null $get_callback    Optional. The callback function used to retrieve the field value. Default is
     106 *                                          'null', the field will not be returned in the response. The function will
     107 *                                          be passed the prepared object data.
     108 *     @type callable|null $update_callback Optional. The callback function used to set and update the field value. Default
     109 *                                          is 'null', the value cannot be set or updated. The function will be passed
     110 *                                          the model object, like WP_Post.
     111 *     @type array|null $schema             Optional. The callback function used to create the schema for this field.
     112 *                                          Default is 'null', no schema entry will be returned.
    113113 * }
    114114 */
Note: See TracChangeset for help on using the changeset viewer.