facetwp_render_params

Overview

Modify the raw data passed from AJAX into FacetWP_Renderer.

Parameters

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

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

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

More examples