Hiding a filter in a view with same filter in contextual filters I've a simple problem. In Views I've city filter(exposed) set that'll show jobs in a city. Now I've set the same City in contextual filters as well with the condition to show all values when no argument is supplied. So this view is "General Advanced Job Search"

Now I want to offer "Jobs in Citi1", "Jobs in Citi2". But I want to reuse the same View without duplicating it. I'd call it "Advanced Job Search given a city".

So I can pass the arguments as Citi1 etc and it'd show Jobs in Citi1 at the same time it'll show City filter as drop down in Filter Criteria. I want to hide this City in Filter criteria as it is of no use as cities are already being limited by the argument passed(Citi1). 

I've tried searching here and there but nothing found. 

In short if argument is passed to a view I want to hide an exposed field show in filter criteria.
The following code will help you to solve your issue.

/**
 * Implement hook_form_alter().
 */
function mymodule_form_alter(&amp;$form, &amp;$form_state, $form_id) {

  if($form_id == 'views_exposed_form') {
    if($form['#id'] == 'views-exposed-form-myview-page') {
       // argument 1 represent city1 
      if(arg(1)) {
        // hide city field 
        unset($form['#info']['filter-jobs_in_city']);
        hide($form['jobs_in_city']);
      }
    }
  }
}


Notes:


Replace form id views-exposed-form-myview-page with your own form id
Replace argument 1 with the right City1 argument index 
Replace jobs_in_city field name with your own city field