How to hide a field on node data entry form in drupal?
问题 I'm using hook_node_presave to pre-populate taxonomy field with group's audience value. Thus, I'm trying to hide taxonomy field on a node data entry form. I tried hook_form_alter, but it didn't work for me. Is it possible to hide it? 回答1: <?php function mymodule_form_alter(&$form, &$form_state, $form_id) { if ($form_id == 'contenttype_node_form') { unset($form['somefield']); } } ?> This works for me just fine. Just change the form id and key of the form field you are targeting, and the field