By default, WordPress searches by keyword. To use a custom query variable for search, you would have to register the custom query variable using query_vars
function wpse250276_register_query_vars( $vars ) {
$vars[] = 'ait-locations';
return $vars;
}
add_filter( 'query_vars', 'wpse250276_register_query_vars' );
Then you need to use pre_get_posts
to alter search query and include your custom taxonomy filter using get_query_var
function wpse250276_pre_get_posts($query) {
if ($query->is_search) {
$tax_query = array();
// add taxonomy query elements
if( !empty( get_query_var( 'ait-locations' ) ) ){
$tax_query[] = array(
'taxonomy' => 'ait-locations',
'field' => 'term_id',
'terms' => array( get_query_var( 'city' ) ),
);
$query->set( 'tax_query', $tax_query );
}
}
return $query;
}
add_filter( 'pre_get_posts','wpse250276_pre_get_posts' );