Overview

Modify the raw data passed from AJAX into FacetWP_Renderer.

Parameters

  • $params | array | An array of input data (see below)

How to use custom PHP code?

PHP code can be added to your (child) theme's functions.php file. Alternatively, you can use the Custom Hooks add-on, or a code snippets plugin. More info

$params = [ 'facets' => [ [ 'facet_name' => 'facet_1', 'selected_values' => [ 'foo' ] ], [ 'facet_name' => 'facet_2', 'selected_values' => [ 'foo', 'bar' ] ] ], 'template' => 'example', 'http_params' => [ 'uri' => 'demo/cars' ], 'extras' => [], 'soft_refresh' => 0, 'is_bfcache' => 1, 'first_load' => 0, 'paged' => 1, ];

Usage

Modify the passed in URI:

How to use custom PHP code?

PHP code can be added to your (child) theme's functions.php file. Alternatively, you can use the Custom Hooks add-on, or a code snippets plugin. More info

add_filter( 'facetwp_render_params', function( $params ) { $params['http_params']['uri'] = 'foo/bar'; return $params; });

More examples

Last updated: May 2, 2023