WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WP_REST_Blocks_Controller::filter_response_by_context() WP 5.0.0

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

Это метод класса: WP_REST_Blocks_Controller

Хуков нет.


Массив. Filtered response.


$WP_REST_Blocks_Controller = new WP_REST_Blocks_Controller();
$var = $WP_REST_Blocks_Controller->filter_response_by_context( $data, $context );
$data(массив) (обязательный)
Response data to fiter.
$context(строка) (обязательный)
Context defined in the schema.

Список изменений

С версии 5.0.0 Введена.

Код WP REST Blocks Controller::filter response by context: wp-includes/rest-api/endpoints/class-wp-rest-blocks-controller.php WP 5.4.2

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;