Views 3 remove exposed filter programmatically I've got several node types each of them referenced to different taxonomy term vocabulary.
For category showing i use taxonomy_display module.

For example, we've got two categories: cues and billiard balls.

Cues has price from, price to and wood type filters.
But balls has no wood type filter.

So i need to remove wood type filter if taxonomy_term tid referenced to billiard balls vocabulary.

Thus, I need to remove one of many exposed filters programmatically.

function modulename_views_pre_view(&amp;$view, &amp;$display_id, &amp;$args) {
  // Some custom logic wich field_info_instances checking ...
  $filter_field = 'filter_id';
  // Removes from everywhere where i can find filter or filters properties
  unset($view-&gt;display[$view-&gt;current_display]-&gt;display_options['filters'][$filter_field]);
  unset($view-&gt;display[$view-&gt;current_display]-&gt;handler-&gt;options['filters'][$filter_field]);
  unset($view-&gt;display_handler-&gt;display-&gt;display_options['filters'][$filter_field]);
  unset($view-&gt;display_handler-&gt;options['filters'][$filter_field]);
}


Filter field removes successfully, but I've got php notice:

  Notice: Undefined index: field_wood_reference_tid in function views_handler_filter_term_node_tid-&gt;exposed_validate()


Also i try to remove field in hook_pre_execute(), but with the same result:

function modulename_views_pre_execute(&amp;$view) {
  $filter_field = 'filter_id';
  unset($view-&gt;display_handler-&gt;handlers['filter'][$filter_field]);
  unset($view-&gt;filter[$filter_field]);
}


Also try with override_option() method like here - http://groups.drupal.org/node/82219, but no result at all.

Any suggestions?
Pls help =)



Thanks to everybody for reply but I still has no answer.
Maybe something is not clear? =(
I would use hook_form_alter using unset on the form object as you are in your example for the element that you want to remove.