WordPress at a glance
function is not described

WP_REST_Blocks_Controller::filter_response_by_context() public WP 5.0.0

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

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

No Hooks.

Return

Array. Filtered response.

Usage

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

Changelog

Since 5.0.0 Introduced.

Code of WP_REST_Blocks_Controller::filter_response_by_context() WP 5.5.1

<?php
public function filter_response_by_context( $data, $context ) {
	$data = parent::filter_response_by_context( $data, $context );

	/*
	 * Remove `title.rendered` and `content.rendered` from the response. It
	 * doesn't make sense for a reusable block to have rendered content on its
	 * own, since rendering a block requires it to be inside a post or a page.
	 */
	unset( $data['title']['rendered'] );
	unset( $data['content']['rendered'] );

	return $data;
}