Метод | Описание | |
---|---|---|
get_field_schema ( ) : array | Retrieves the object's meta schema, conforming to JSON Schema. | |
get_value ( integer $object_id, WP_REST_Request $request ) : WP_Error | object | Retrieves the meta field value. | |
prepare_value ( mixed $value, WP_REST_Request $request, array $args ) : mixed | Prepares a meta value for output. | |
register_field ( ) | Registers the meta field. | |
update_value ( WP_REST_Request $request, integer $object_id ) : WP_Error | null | Updates meta values. |
Метод | Описание | |
---|---|---|
delete_meta_value ( integer $object_id, string $meta_key, string $name ) : boolean | WP_Error | Deletes a meta value for an object. | |
get_meta_type ( ) : string | Retrieves the object meta type. | |
get_registered_fields ( ) : array | Retrieves all the registered meta fields. | |
get_rest_field_type ( ) : string | Retrieves the object type for register_rest_field(). | |
prepare_value_for_response ( mixed $value, WP_REST_Request $request, array $args ) : mixed | Prepares a meta value for a response. | |
update_meta_value ( integer $object_id, string $meta_key, string $name, mixed $value ) : boolean | WP_Error | Updates a meta value for an object. | |
update_multi_meta_value ( integer $object_id, string $meta_key, string $name, array $values ) : boolean | WP_Error | Updates multiple meta values for an object. |
protected delete_meta_value ( integer $object_id, string $meta_key, string $name ) : boolean | WP_Error | ||
$object_id | integer | Object ID the field belongs to. |
$meta_key | string | Key for the field. |
$name | string | Name for the field that is exposed in the REST API. |
Результат | boolean | WP_Error | True if meta field is deleted, WP_Error otherwise. |
public get_field_schema ( ) : array | ||
Результат | array | Field schema data. |
abstract protected get_meta_type ( ) : string | ||
Результат | string | One of 'post', 'comment', 'term', 'user', or anything else supported by `_get_meta_table()`. |
protected get_registered_fields ( ) : array | ||
Результат | array | Registered fields. |
abstract protected get_rest_field_type ( ) : string | ||
Результат | string | The REST field type, such as post type name, taxonomy name, 'comment', or `user`. |
public static prepare_value ( mixed $value, WP_REST_Request $request, array $args ) : mixed | ||
$value | mixed | Meta value from the database. |
$request | WP_REST_Request | Request object. |
$args | array | REST-specific options for the meta key. |
Результат | mixed | Value prepared for output. If a non-JsonSerializable object, null. |
protected update_meta_value ( integer $object_id, string $meta_key, string $name, mixed $value ) : boolean | WP_Error | ||
$object_id | integer | Object ID to update. |
$meta_key | string | Key for the custom field. |
$name | string | Name for the field that is exposed in the REST API. |
$value | mixed | Updated value. |
Результат | boolean | WP_Error | True if the meta field was updated, WP_Error otherwise. |
protected update_multi_meta_value ( integer $object_id, string $meta_key, string $name, array $values ) : boolean | WP_Error | ||
$object_id | integer | Object ID to update. |
$meta_key | string | Key for the custom field. |
$name | string | Name for the field that is exposed in the REST API. |
$values | array | List of values to update to. |
Результат | boolean | WP_Error | True if meta fields are updated, WP_Error otherwise. |
public update_value ( WP_REST_Request $request, integer $object_id ) : WP_Error | null | ||
$request | WP_REST_Request | Full details about the request. |
$object_id | integer | Object ID to fetch meta for. |
Результат | WP_Error | null | WP_Error if one occurs, null on success. |