[ Index ] |
PHP Cross Reference of WordPress |
[Source view] [Print] [Project Stats]
REST API: WP_REST_Meta_Fields class
File Size: | 624 lines (18 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
get_meta_subtype() X-Ref |
Retrieves the object meta subtype. since: 4.9.8 return: string Subtype for the meta type, or empty string if no specific subtype. |
register_field() X-Ref |
Registers the meta field. since: 4.7.0 |
get_value( $object_id, $request ) X-Ref |
Retrieves the meta field value. since: 4.7.0 param: int $object_id Object ID to fetch meta for. param: WP_REST_Request $request Full details about the request. return: array Array containing the meta values keyed by name. |
prepare_value_for_response( $value, $request, $args ) X-Ref |
Prepares a meta value for a response. This is required because some native types cannot be stored correctly in the database, such as booleans. We need to cast back to the relevant type before passing back to JSON. since: 4.7.0 param: mixed $value Meta value to prepare. param: WP_REST_Request $request Current request object. param: array $args Options for the field. return: mixed Prepared value. |
update_value( $meta, $object_id ) X-Ref |
Updates meta values. since: 4.7.0 param: array $meta Array of meta parsed from the request. param: int $object_id Object ID to fetch meta for. return: null|WP_Error Null on success, WP_Error object on failure. |
delete_meta_value( $object_id, $meta_key, $name ) X-Ref |
Deletes a meta value for an object. since: 4.7.0 param: int $object_id Object ID the field belongs to. param: string $meta_key Key for the field. param: string $name Name for the field that is exposed in the REST API. return: true|WP_Error True if meta field is deleted, WP_Error otherwise. |
update_multi_meta_value( $object_id, $meta_key, $name, $values ) X-Ref |
Updates multiple meta values for an object. Alters the list of values in the database to match the list of provided values. since: 4.7.0 param: int $object_id Object ID to update. param: string $meta_key Key for the custom field. param: string $name Name for the field that is exposed in the REST API. param: array $values List of values to update to. return: true|WP_Error True if meta fields are updated, WP_Error otherwise. |
update_meta_value( $object_id, $meta_key, $name, $value ) X-Ref |
No description |
is_meta_value_same_as_stored_value( $meta_key, $subtype, $stored_value, $user_value ) X-Ref |
Checks if the user provided value is equivalent to a stored value for the given meta key. since: 5.5.0 param: string $meta_key The meta key being checked. param: string $subtype The object subtype. param: mixed $stored_value The currently stored value retrieved from get_metadata(). param: mixed $user_value The value provided by the user. return: bool |
get_registered_fields() X-Ref |
Retrieves all the registered meta fields. since: 4.7.0 return: array Registered fields. |
get_field_schema() X-Ref |
Retrieves the object's meta schema, conforming to JSON Schema. since: 4.7.0 return: array Field schema data. |
prepare_value( $value, $request, $args ) X-Ref |
Prepares a meta value for output. Default preparation for meta fields. Override by passing the `prepare_callback` in your `show_in_rest` options. since: 4.7.0 param: mixed $value Meta value from the database. param: WP_REST_Request $request Request object. param: array $args REST-specific options for the meta key. return: mixed Value prepared for output. If a non-JsonSerializable object, null. |
check_meta_is_array( $value, $request, $param ) X-Ref |
Check the 'meta' value of a request is an associative array. since: 4.7.0 param: mixed $value The meta value submitted in the request. param: WP_REST_Request $request Full details about the request. param: string $param The parameter name. return: array|false The meta array, if valid, false otherwise. |
default_additional_properties_to_false( $schema ) X-Ref |
Recursively add additionalProperties = false to all objects in a schema if no additionalProperties setting is specified. This is needed to restrict properties of objects in meta values to only registered items, as the REST API will allow additional properties by default. since: 5.3.0 param: array $schema The schema array. return: array |
get_empty_value_for_type( $type ) X-Ref |
Gets the empty value for a schema type. since: 5.3.0 param: string $type The schema type. return: mixed |
Generated: Sun Oct 13 01:00:02 2024 | Cross-referenced by PHPXref 0.7.1 |