How to programmatically create an exposed filter? Is there a way to create programmatically exposed filters in Drupal 7?

I searched a lot but I found only topics related remove or alter exposed filters already available in a view.

By instance my view doesn't provide any exposed filter. 
I must create it through the code in my module.
I have a view but I can't change it via Views administration interface.
I must achieve the result by implementing hook_views_pre_view() and add_item().

Unfortunately add_item is not very well documented or, at least, not the part concerning the $options array structure.

Given 'field_status' a "select list" with 3 items defined in the field configuration, and the following piece of code:

 function hook_views_pre_view(&amp;$view, &amp;$display_id, &amp;$args) {
   $field = field_info_field('field_status');
   if (!empty($field)) {
    $filter = array(
     'identifier' =&gt; 'field_status',
     'exposed' =&gt; TRUE,
     'is_grouped' =&gt; FALSE,
     'table' =&gt; 'field_data_field_status',
     'type' =&gt; 'list_text',
     'expose' =&gt; array(
       'operator_id' =&gt; 'field_status_value',
       'label' =&gt; 'Status',
     )
   );
   $view-&gt;add_item($view-&gt;current_display, 'filter', 'field_data_field_status', 'field_status_value', $filter);
   $view-&gt;display_handler-&gt;set_option('css_class', 'view-status');
}


what should be the structure of the array $options (in my case $filter)? 

As a result of this I can see the submit button 'Apply' and the label "Status" in an empty widget 'div'.

Here is the code edited following suggestions in comments:

function my_module_views_default_views_alter(&amp;$views) {
  if (array_key_exists('my_view_name', $views)) {

    $options = array (
      0 =&gt; 'Blocked',
      1 =&gt; 'Active',
    );

    $display = $views['my_view_name']-&gt;display['my_view_page'];

    $display-&gt;display_options['filters']['field_status']['id'] = 'field_status';
    $display-&gt;display_options['filters']['field_status']['table'] = 'field_data_field_status';
    $display-&gt;display_options['filters']['field_status']['field'] = 'field_status';
    $display-&gt;display_options['filters']['field_status']['exposed'] = TRUE;
    $display-&gt;display_options['filters']['field_status']['expose']['operator_id'] = 'field_status_value';
    $display-&gt;display_options['filters']['field_status']['expose']['label'] = 'Status';
    $display-&gt;display_options['filters']['field_status']['expose']['operator'] = 'field_status_value';
    $display-&gt;display_options['filters']['field_status']['expose']['identifier'] = 'field_status';
    $display-&gt;display_options['filters']['field_status']['value'] = $options;

    $views['my_view_name']-&gt;display['my_view_page'] = $display;
  }
}


--- ALTERNATIVE SOLUTION ---

Since this problem seems to be hard to fix (@ least for my specific case) I have used a workaround to achieve the goal.
The solution consists basically on a Views Block Clone with Exposed Filters which overrides the Views Block (without exposed filters) according to specific cases (Is User LoggedIn, Content Type, Contextual Filters ecc..).
Can you please try with hook_views_default_views_alter function. This function should be defined in MODULE_NAME/views/MODULE_NAME.views.inc file. And don't forget to include this file on .info file as files[] = views/MODULE_NAME.views.inc.

 function MODULE_NAME_views_default_views_alter(&amp;$views) {
        if (array_key_exists('MY_VIEW_NAME', $views)) {
          $options = array(
          0 =&gt; 'Blocked',
          1 =&gt; 'Active',
          ); 
          $display = $views['MY_VIEW_NAME']-&gt;display['MY_VIEW_PAGE'];
          $display-&gt;display_options['filters']['field_status']['id'] = 'field_status';
          $display-&gt;display_options['filters']['field_status']['table'] = 'field_data_field_status';
          $display-&gt;display_options['filters']['field_status']['field'] = 'field_status';
          $display-&gt;display_options['filters']['field_status']['value'] = $options;
          $display-&gt;display_options['filters']['field_status']['exposed'] = TRUE;
          $display-&gt;display_options['filters']['field_status']['expose']['operator_id'] = 'field_status_value';
          $display-&gt;display_options['filters']['field_status']['expose']['label'] = 'Status';
          $display-&gt;display_options['filters']['field_status']['expose']['operator'] = 'field_status_value';
          $display-&gt;display_options['filters']['field_status']['expose']['identifier'] = 'field_status';
          $views['MY_VIEW_NAME']-&gt;display['MY_VIEW_PAGE'] = $display;
          }
    }