Dear tribe team,
My filter bar is defined to precheck the checkbox for a certain venue when the calendar loads. This is good. However, when I reset the filter (using the button) the prececked checkbox stays checked. Can you help me to modify this piece of code you gave me to allow the filter button to properly work?
add_filter( ‘tribe_events_filter_values’, ‘modify_filter_venues’, 20, 2);
function modify_filter_venues ( $filter_values, $slug ) {
if($slug == ‘venues’) {
$venue_id = 388;
if ( $key = array_search($venue_id, array_column($filter_values, ‘value’)) ) {
$selected_venue = array_splice($filter_values, $key, 1);
array_unshift($filter_values, $selected_venue[0]);
}
}
return $filter_values;
}