WP_REST_Controller::filter_response_by_context()publicWP 4.7.0

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

Метод класса: WP_REST_Controller{}

Хуков нет.

Возвращает

Массив. Filtered response.

Использование

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

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

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

Код WP_REST_Controller::filter_response_by_context() WP 6.5.2

public function filter_response_by_context( $response_data, $context ) {

	$schema = $this->get_item_schema();

	return rest_filter_response_by_context( $response_data, $schema, $context );
}