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.


Built from https://develop.svn.wordpress.org/trunk@45810


git-svn-id: http://core.svn.wordpress.org/trunk@45621 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
K. Adam White
2019-08-15 20:04:55 +00:00
parent 8dcc10693f
commit dbfa0c7ed4
3 changed files with 15 additions and 15 deletions

View File

@@ -102,14 +102,14 @@ function register_rest_route( $namespace, $route, $args = array(), $override = f
* @param array $args {
* Optional. An array of arguments used to handle the registered field.
*
* @type string|array|null $get_callback Optional. The callback function used to retrieve the field
* value. Default is 'null', the field will not be returned in
* the response.
* @type string|array|null $update_callback Optional. The callback function used to set and update the
* field value. Default is 'null', the value cannot be set or
* updated.
* @type string|array|null $schema Optional. The callback function used to create the schema for
* this field. Default is 'null', no schema entry will be returned.
* @type callable|null $get_callback Optional. The callback function used to retrieve the field value. Default is
* 'null', the field will not be returned in the response. The function will
* be passed the prepared object data.
* @type callable|null $update_callback Optional. The callback function used to set and update the field value. Default
* is 'null', the value cannot be set or updated. The function will be passed
* the model object, like WP_Post.
* @type array|null $schema Optional. The callback function used to create the schema for this field.
* Default is 'null', no schema entry will be returned.
* }
*/
function register_rest_field( $object_type, $attribute, $args = array() ) {