/rest_api/response

DescriptionDescription

This filter is run before the request response is returned.

It is used to format and modify the response of the request.

ArgumentsArguments

ArgumentTypeDescription
$responsearrayHolds response data
$requestWP_REST_RequestGenerated request object

ExampleExample

PHP
functions.php
function prefix_rest_api_response( $response, $request ) {

	$respone['my_data'] = 'some data';

	return $respone;

};

add_filter( 'wp_grid_builder/rest_api/response', 'prefix_rest_api_response', 10, 2 );