Summery Summery

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

Syntax Syntax

WP_REST_Blocks_Controller::filter_response_by_context( array $data, string $context )

Parameters Parameters


(array) (Required) Response data to fiter.


(string) (Required) Context defined in the schema.

Return Return

(array) Filtered response.

Source Source

File: wp-includes/rest-api/endpoints/class-wp-rest-blocks-controller.php

		$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;


Changelog Changelog

Version Description
5.0.0 Introduced.


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.