Forms in Drupal always have fields as standard:

e.g. Menu Settings
Authoring Information
Revision Information

How do you hide these elements in Drupal 6?

In Drupal 5, I would place the following code in my template.php:

function atntheme_register_interest_node_form($form) {
$output = '';
$form['options'] ['revision'] = 'hidden';
$form['menu']  = 'hidden';
$form['path']  = 'hidden';
$form['log']['#title'] = t('Admin Notes (optional)');

This code not only lets you hide elements but also rename them. You can use Firebug for Drupal to easily find out the code for each element on a form.

However, this doesn't work in Drupal 6.

This page has a guide for doing the above code in Drupal 6.
However, the guide doesn't explain how to hide elements such as the Menu Settings or Authoring information.

I have watched many screen casts on Drupal Dojo and looked at several websites, but I am at a lost on how to hide (or rename) elements in Drupal 6 forms.

I think the main problem is that I do not know how to extract the code for form elements in a Drupal 6 format. (I have tried using both Devl Module and Firebug for Drupal).

Does anyone have any pointers?



Have you tried looking at the form as a normal user (someone other than user 1 that can add/edit content)?

Unless you have granted them the appropriate permissions those fields should not show and it would be risky to hide them from user 1.

You can always add drupal_set_message('<pre>' . print_r($form, TRUE) . '</pre>'); at the start of the function to see the fields.

I've recently learned how to work with the Form API, and since the documentation in some areas is a bit outdated (e.g. for Drupal 6, the page you referenced) I am trying to write some of my own examples to put on Here's the info I'm working on, sharing the code I write code for my own site
If you are only trying to modify some form elements (e.g. titles, weight, etc... or unsetting some things), then going the full route of setting up a template file for the form and exposing all the form elements as variables for the template is overboard... you can instead just alter the form elements in hook_form_alter or hook_theme and let the altered form print out as normal. Some form tweaks (though I'm not fluent in exactly which) can only be done through a module. For instance here's a snippet I added the other day which I was not able to give an example for in hook_theme() (I added my hook_theme attempt of the code into the comments in case anyone happens to know if/how to make it work there):

I have figured this out.

If you use the Devl module, you can turn on "Display form element keys and weights". This will allow you to extract code in Drupal 6 format.

Although I can now hide format elements (by not printing them in my node-name.tpl.php file), there doesn't seem to be away to rename them. (E.g. rename Log Message to Administrators Notes).

In Drupal 5, I would achieve this by using this code in the template.php file:

function atntheme_bookablecourse_node_form($form) {
$output = '';
$form['log']['#title'] = t('Admin Notes (optional)');
$form['log']['#description'] = t('Use this as a private note pad for the above content');
$output .= drupal_render($form);
return $output;

This doesn't work in Drupal 6. Any Pointers?

Also is possible to make my changes apply to multiple content types (e.g. hide the Menu section on every content type).

If you want to hide a form element, implement hook_form_alter():

function mymodule_form_alter(&$form, $form_state, $form_id) {
$form_id == 'myform') {
$form['element_to_hide']['#access'] = false;

Note that you can also unset($form['element_to_hide']); in a form alter, but has other implications.

Is this a better method than using the following in template.php:

// we register the form to the theme registry
function swb_theme(){
  return array(
'photo_product_node_form' => array(
'arguments' => array('form' => NULL),
'template' => 'edit_photo_product_node_form',
swb_preprocess_photo_product_node_form(&$vars) {
$vars['form']['menu']['#access'] = FALSE;
$vars['form']['author']['#access'] = FALSE;

I'm looking for a solution. Thank you for ur post.

Nice solution .. I needed this cause I had a field like a flag that I want to hide and not unset! Unset removes it from $_POST but I didn't want that.. Thanks a million!

About hiding the "Revision information" more solutions can be found at

How to contribute to Drupal.