DescriptionDescription
This filter is called every time facet settings are queried.
It allows to dynamically change or add setting parameter(s) to a specific facet in order to change its behaviour.
ArgumentsArguments
Argument | Type | Description |
$settings | array | Holds facet settings |
ExampleExample
PHP
functions.php
function prefix_facet_settings( $settings ) {
// If it matches facet id 1, change facet display order.
if ( 1 === $settings['id'] ) {
$settings['orderby'] = 'count';
}
// If it matches facet id 2, hide facet children.
if ( 2 === $settings['id'] ) {
$settings['children'] = 0;
}
return $settings;
}
add_filter( 'wp_grid_builder/facet/settings', 'prefix_facet_settings', 10, 1 );