Filter: bricks/query_filters/filter_query_vars
Filter: bricks/query_filters/filter_query_vars
Section titled “Filter: bricks/query_filters/filter_query_vars”Filters the query variables generated by an active filter element before they are applied to the query loop. This allows you to customize how specific filters affect the query.
Parameters
Section titled “Parameters”$query_vars(array): TheWP_Queryarguments generated by this filter.$filter(array): The active filter data (settings, selected values).$query_id(string): The ID of the query loop being filtered.$filter_index(int): The index of this filter in the active filters list.
Example usage
Section titled “Example usage”add_filter( 'bricks/query_filters/filter_query_vars', function( $query_vars, $filter, $query_id, $filter_index ) { // Example: Add extra query args for a specific filter if ( $filter['settings']['fieldName'] === 'my_special_filter' ) { $query_vars['post_status'] = 'publish'; }
return $query_vars;}, 10, 4 ); Was this page helpful?