How to remove an option from an exposed filter with a drop-down list? This is this drop-down list for the field field_gender on the view whose name is members:


M|Male
F|Female


I know the following callback is executed (tested with var_dump...), but it doesn't do what I think it should do: Provide only the option which value is "M" for "Male" (this choice is decided programmatically, Views UI won't work).

Here is the callback:

/**
* Implementation of hook_views_pre_...().
*/
// function mymodule_views_pre_render(&amp;$view){
// function mymodule_views_pre_build(&amp;$view){
function mymodule_views_pre_execute(&amp;$view){
    if ($view-&gt;name == 'members') {

        // get our filters
        $filters = $view-&gt;display_handler-&gt;get_option('filters');

        // Force
        $filters['field_gender_value']['value'] = array('M' =&gt; 'M');

        // apply changes
        $view-&gt;display_handler-&gt;override_option('filters', $filters);
    }    
}
You use hook_form_alter:

/**
 * Implementation of hook_form_alter().
 */
  function mymodule_form_alter(&amp;$form, &amp;$form_state, $form_id) {
  switch ($form_id) {
  case 'views_exposed_form':
    // Force
    $form['field_gender_value']['#options'] = array('M' =&gt; 'M');
    break;
  }
}