WordPress at Your Fingertips
function is not described

WP_REST_Controller::filter_response_by_context() public WP 4.7.0

Filters a response based on the context defined in the schema.

{} It's a method of the class: WP_REST_Controller{}

No Hooks.


Array. Filtered response.


$WP_REST_Controller = new WP_REST_Controller();
$WP_REST_Controller->filter_response_by_context( $data, $context );
$data(array) (required)
Response data to filter.
$context(string) (required)
Context defined in the schema.


Since 4.7.0 Introduced.

Code of WP_REST_Controller::filter_response_by_context() WP 5.8

public function filter_response_by_context( $data, $context ) {

	$schema = $this->get_item_schema();

	return rest_filter_response_by_context( $data, $schema, $context );