hook_form_alter hiding field only in the form I have a content type with fields added from the core module and I want to hide some fields in the edit form, but not in the page node.

I've tried with

$form['my_field']['#access'] = FALSE; in my custom module, but that hides the field in the node page too.
Is there any other way to hide the field only in edit form?

My approach was to wrap some fields into a two columns. Here's what I've tried:

  &lt;?php 
    /*
     * Implements hook_form_alter().
     */

    function my_module_form_alter (&amp;$form, &amp;$form_state, $form_id) {
         switch ($form_id) {

          case 'custom_node_form':

          $form['column_left'] = array(
          '#prefix' =&gt; '&lt;div class="column-left"&gt;',
          '#suffix' =&gt; '&lt;/div&gt;',
            );

           $form['column_left']['custom_field'] = $form['custom_field'];
           $form['custom_field']['#access'] = FALSE;
         break; 
       }
    }


Unfortunately it's disabling into the page node too. I'm using Display suite for the full content and I'm pretty much sure that the field is not hidden from there.
Have you checked

admin/structure/types/manage/my_content_type/display


Your field is probably hidden here.

Otherwise, hook_form_alter is only for form you are right

An other attribute is :

$form['my_field']['#disabled'] = TRUE;