Changing the initial value of an exposed view filter I'm trying to programmatically set the starting value of an exposed view filter (so that it initially loads the view with data matching that value).

I've managed to change the filter field value with this code in a views_pre_build hook (doesn't work in pre_execute or pre_render):

$view-&gt;display[$view-&gt;current_display]-&gt;handler-&gt;handlers['filter']['field_year_value']-&gt;value['value'] = $year;


But the view still loads with the value from the view filter's config value.  How can I get my change reflected in the view when it loads?
For some reason a site I was adding a feature to had a years taxonomy vocabulary, with a number of terms, one for each year in a range. So I wanted to auto set the exposed filter to the current year, but to do so needed to set the filter value with the tid of the right term. 

I implement hook_views_query_alter().

check if the view is the right name and if the view doesn't have any user selected input (this view only had one filter).

You have to alter the value for the filter's query value

You have to unset the exposed filter area markup and regenerate it.

 function mymodule_views_query_alter(&amp;$view, &amp;$query) {

      if($view-&gt;name == 'executive_committee' &amp;&amp; empty($view-&gt;exposed_input)) {
        $current_year = date('Y');
        // find year term id
        $term_query = new EntityFieldQuery();
        $tids = $term_query-&gt;entityCondition('entity_type', 'taxonomy_term')
          -&gt;propertyCondition('name', $current_year)
          -&gt;propertyCondition('vid', 3)
          -&gt;execute();

        if(!empty($tids['taxonomy_term'])) {
          $tids = array_keys($tids['taxonomy_term']);
          $current_year_tid = reset($tids);

          // set values to the views object and query objet
          $view-&gt;exposed_data['field_year_tid'] = $current_year_tid;
          unset($view-&gt;exposed_widgets);
          $view-&gt;exposed_raw_input['field_year_tid'] = $current_year_tid;
          $query-&gt;where[1]['conditions'][2]['value'] = $current_year_tid;
          // rebuild the exposed form
          $form_state = array(
            'view' =&gt; $view,
            'display' =&gt; $view-&gt;display_handler-&gt;display,
            'exposed_form_plugin' =&gt; $view-&gt;display_handler-&gt;get_plugin('exposed_form'),
            'method' =&gt; 'get',
            'rerender' =&gt; TRUE,
            'no_redirect' =&gt; TRUE,
            'always_process' =&gt; TRUE, // This is important for handle the form status.
          );
          $form = drupal_build_form('views_exposed_form', $form_state);
          $form['field_year_tid']['#value'] = $current_year_tid;
          $view-&gt;exposed_widgets = drupal_render($form);

        }

      }
    }