Registers a new field on an existing WordPress object type.
Parameters
$object_typestring|array
Object(s) the field is being registered to, "post"|"term"|"comment" etc.
$attributestring
The attribute name.
$argsarrayoptional
An array of arguments used to handle the registered field.Default: array()
$get_callbackcallable|null
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.
$update_callbackcallable|null
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.
$schemaarray|nulldefault: is 'null', no schema entry will be returned
Optional. The schema for this field.
Uses · 1
wp_parse_args()Merges user defined arguments into defaults array.
Signature, return type and hooks compared across 5 parsed releases.
About this page
Parsed data
Generated from the wordpress-develop 7.1.0 tag, from src/wp-includes/rest-api.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.