Using hook_form_alter to hide a field in a view exposed filter I am using hook_form_alter to hide a field in a view exposed filter.

function cars_form_alter(&amp;$form, &amp;$form_state, $form_id) { 
if($form_id == "views_exposed_form"){
    $form['field_price__1']['#type'] = 'hidden';
  }
}


My questions are :


It only works if use $form_id == "views_exposed_form". But I don't want for all views only for my specific one which has form_id=views_exposed_form_car-results_panel_pane_3 ,but it doesn't work if I use the specific form id
Using the above snippet,I can hide the field but not its Label.How can I hide also the label?
One possible way to alter the exposed filter for specific view is the following:

/**
 * Implements hook_form_alter().
 */
function MYMODULE_form_alter(&amp;$form, &amp;$form_state, $form_id) {
        // Check if the form contains exposed filter form element.
    if ($form_id == 'views_exposed_form') {
        // Here you can define the check for specific view so that it doesnt apply to all views.
        $view = $form_state['view'];
        // If you have multiple display in view than you can add a check for specific display
        // as '$view-&gt;current_display == 'DISPLAY_NAME' in the below if condition with '&amp;&amp;'.
        if ($view-&gt;name === 'MY_VIEW_MACHINE_NAME') {
            // Add your code for specific form.
        }
    }
}


And for hiding the label of particular element, check #title_display: Indicates how the label should be rendered. The label includes the #title and the required marker, if #required. If the #title is empty but the field is #required, the label will contain only the required marker.


  '#title_display' => 'invisible'




UPDATE:

Also you may try using hook_form_views_exposed_form_alter as below:

/**
 * Implements hook_form_alter().
 */
function MYMODULE_form_views_exposed_form_alter(&amp;$form, $form_state, $form_id) {
  // To check the form id of your view.
  print_r($form_id);
}