I have multiple filters in my posts list. i make the filters work like this :
add_filter( 'parse_query','event_table_filter' );
function event_table_filter( $query ){
$type = 'event';
if (isset($_GET['post_type'])) {
$type = $_GET['post_type'];
}
if ( 'event' == $type && is_admin() && isset($_GET['ADMIN_FILTER_FIELD_LOCATION']) && $_GET['ADMIN_FILTER_FIELD_LOCATION'] != '') {
$query->query_vars['meta_key'] = 'location';
$query->query_vars['meta_value'] = $_GET['ADMIN_FILTER_FIELD_LOCATION'];
}
if ( 'event' == $type && is_admin() && isset($_GET['ADMIN_FILTER_FIELD_FEATURED']) && $_GET['ADMIN_FILTER_FIELD_FEATURED'] != '') {
$query->query_vars['meta_key'] = 'position';
$query->query_vars['meta_value'] = $_GET['ADMIN_FILTER_FIELD_FEATURED'];
}
}
right now, my 2 filters (location and position) are working but individually. If i try to make a filters by position AND Location, it filtering only by what it seem to be the last query (position). how can i make my query take in consideration every filters?
I have done like this: