Summery Summery
Filters a response based on the context defined in the schema.
Syntax Syntax
Parameters Parameters
- $data
-
(Required) Response data to fiter.
- $context
-
(Required) Context defined in the schema.
Return Return
(array) Filtered response.
Source Source
File: wp-includes/rest-api/endpoints/class-wp-rest-controller.php
public function filter_response_by_context( $data, $context ) { $schema = $this->get_item_schema(); return rest_filter_response_by_context( $data, $schema, $context ); } /** * Retrieves the item's schema, conforming to JSON Schema. * * @since 4.7.0 * * @return array Item schema data. */ public function get_item_schema() { return $this->add_additional_fields_schema( array() ); } /** * Retrieves the item's schema for display / public consumption purposes. * * @since 4.7.0 * * @return array Public item schema data. */ public function get_public_item_schema() { $schema = $this->get_item_schema(); if ( ! empty( $schema['properties'] ) ) { foreach ( $schema['properties'] as &$property ) {
Advertisement
Changelog Changelog
Version | Description |
---|---|
4.7.0 | Introduced. |