Modify the visibility of a form field label with #label_display attribute In D7, I am trying to "hide" a field label through form_alter:

 case 'postal_code_node_form':

   // Set fields as not required
    $form['title']['#required'] = FALSE;
    $form['body']['#required'] =  FALSE;

    // Add css to hide fields.
    $form['body']['#attributes']  = array('style' =&gt; 'display:none');
    $form['title']['#attributes'] = array('style' =&gt; 'display:none;');

    $form['body']['#label_display']  = 'hidden';
    $form['title']['#label_display'] = 'hidden';

    break;


Unfortunately, the label is still displayed. I could do it through CSS or JavaScript, but I would prefer doing this through hook_form_alter(), so all form modifications are at the same place.
I know this is over a year old, but completely removing the form labels in this way is probably not a good idea in terms of accessibility.

Instead, take a look at #title_display defined by the FormAPI. FieldAPI has something very similar called #label_display.