/facet/response

DescriptionDescription

This filter is called before to send facet response to the frontend.

It allows to modify and/or add arguments in the facet response that can be used on the frontend.

ArgumentsArguments

ArgumentTypeDescription
$responsearrayHolds facet response
$facetarrayHolds facet settings
$choicesarrayHolds facet choices

ExampleExample

PHP
functions.php
function prefix_facet_response( $response, $facet, $choices ) {

	// If it's a date facet.
	if ( 'date' === $facet['type'] ) {

		// We push min/max dates to be used on the frontend.
		$response['settings']['minDate'] = '2017-04-16';
		$response['settings']['maxDate'] = '2019-01-13';

	}

	return $response;

}

add_filter( 'wp_grid_builder/facet/response', 'prefix_facet_response', 10, 3 );