Skip to content
Get Bricks

Filter: bricks/filter_element/filtered_source

Filter: bricks/filter_element/filtered_source

Section titled “Filter: bricks/filter_element/filtered_source”

Filters the data retrieved from the index representing the available filter options and their counts based on the current query results.

  • $filtered_source (array): Associative array where keys are filter values and values are their respective counts (based on the current filtered query).
  • $element (object): The filter element instance.
add_filter( 'bricks/filter_element/filtered_source', function( $filtered_source, $element ) {
// Example: Ensure a specific value is always present with a count of 0 if missing
if ( ! isset( $filtered_source['some_value'] ) ) {
$filtered_source['some_value'] = 0;
}
return $filtered_source;
}, 10, 2 );