How To Remove Format Options / Guideliness From Comments Textarea in Drupal 7

The task is very common, but in Drupal 7 you do this in a bit different way than in Drupal 6. Here’s how to remove format options from comments textarea in Drupal 7:

UPD: Well, the most easiest way to do this is to install Better Formats module ( But do we need another module installed to do this simple thing? Me, not, so let's dig into the code a bit.

Basically, we need to alter comment form. You can do this in two ways:

  1. By putting your custom code into template.php file
  2. By putting your custom code into your custom module

It’s up to you which way to choose. If you want your changes to be applicable not only to the active theme, then choose the second option.

Ok, now, depending on a way you’ve chosen, add this code to your template.php or module_name.module file:

function ModulNameOrYourThemeName_form_comment_form_alter(&$form, &$form_state, &$form_id) {
  $form['comment_body']['#after_build'][] = 'ModulNameOrYourThemeName_customize_comment_form';  

Option A) If you only want to hide formatting guidelines and Filter Tips link, then add this function to the file:

function ModulNameOrYourThemeName_customize_comment_form(&$form) {
  // Hide guideliness
  $form[LANGUAGE_NONE][0]['format']['guidelines']['#access'] = FALSE; // Note ‘und’, you may need to set your comment form language code instead
  // Hide Filter Tips
  $form[LANGUAGE_NONE][0]['format']['help']['#access'] = FALSE;
  return $form;  

Option B) If you want to hide all format options, then add this function to the file:

function ModulNameOrYourThemeName_customize_comment_form(&$form) {  
  $form[LANGUAGE_NONE][0]['format']['#access'] = FALSE; // Note LANGUAGE_NONE, you may need to set your comment form language code instead    
  return $form;  

Save your file and don’t forget to clear Drupal’s cache (Configuration > Development > Performance > Clear All Caches).

That’s all for now, enjoy and happy drupalling!


Submitted by vikky on Mon, 2011-07-11 01:13

Although it works partially, I am unable to remove "More information abut text formats". How do I remove that?

Thanks a lot!!

Submitted by Tim on Mon, 2011-07-11 10:41

Please see "Option A" function updated.

Submitted by Jack on Wed, 2014-07-23 19:07

This coding are really helpful thanks for sharing update

Submitted by dalin on Mon, 2011-07-11 08:59

Or the easier, more maintainable option:

Submitted by Tim on Mon, 2011-07-11 10:29

I know about this module, but for doing this simple thing I don't want to install another module.

Submitted by EvanDonovan on Tue, 2011-07-12 01:39

Was there a particular reason you used #after_build instead of just hook_form_alter? Worried about some module later in the execution order clobbering the changes?

Submitted by Tobias on Wed, 2011-11-23 02:08

Dear Tim,

your instructions are exactly what I need, however it does not work for me!

Here is the code in my module invitation:
function invitation_form_comment_form_alter(&$form, &$form_state, &$form_id) {
$form['comment_body']['#after_build'][] = 'invitation_customize_comment_form';
function invitation_customize_comment_form(&$form) {
$form[LANGUAGE_NONE][0]['format']['#access'] = FALSE;
return $form;

Seems to me like I copied it correctly. I do not manage to get an output of the comment form via drupal_set_message in this hook, so I am struggling with the debugging. Can you advise me how I can find the mistake in my case, please??

Thanks a lot, Tobias

Submitted by Kannary on Wed, 2011-12-28 04:33

Another option is to use the awesome MyHook Administration module, in which case you can inject module-level hooks anywhere:

If using this module, then add the functions like such:

//Remove Formatting Tips and Links from Comments

function myhook_form_comment_form_alter(&$form, &$form_state, &$form_id) {
$form['comment_body']['#after_build'][] = 'myhook_customize_comment_form';

function myhook_customize_comment_form(&$form) {
// Hide guideliness
$form[LANGUAGE_NONE][0]['format']['guidelines']['#access'] = FALSE; // Note ‘und’, you may need to set your comment form language code instead
// Hide Filter Tips
$form[LANGUAGE_NONE][0]['format']['help']['#access'] = FALSE;
return $form;

Submitted by Angelo on Thu, 2012-01-05 11:55

I have no comment form but in order to "remove" the "more information about text formats" link in my admin theme I ended like this in my theme css:

.filter-help{display: none;}

Submitted by fourmi4x on Fri, 2012-01-06 01:02

Thanks for sharing this, exactly what I was looking for !

Submitted by jkool on Sat, 2012-01-14 17:01

Works fine for comments, but how on earth do I remove this for the "text format" stuff for the node itself?

Submitted by blackangelxl on Fri, 2012-01-20 11:00

Take this:

* Function - yourthemename_form_comment_form_alter.
* @param array $form
* @param type $form_state
* @param type $form_id
function yourthemename_form_comment_form_alter(&$form, &$form_state, &$form_id) {
$form['comment_body']['#after_build'][] = 'yourthemename_customize_comment_form';

* Function - yourthemename_customize_comment_form.
* @param type $form
* @return boolean
function yourthemename_customize_comment_form(&$form) {
$form[LANGUAGE_NONE][0]['format']['guidelines']['#access'] = FALSE;
$form[LANGUAGE_NONE][0]['format']['help']['#access'] = FALSE;
$form[LANGUAGE_NONE][0]['format']['#attributes'] = array('style' => 'display: none;');
return $form;

Submitted by Nate Dunham on Wed, 2012-04-11 20:24

Ahh.. thanks for all the help. Had trouble finding the solution for removing the format options. It's a great help!

Submitted by Jason on Sun, 2012-04-15 09:50

How do I remove just the selector, but leave the quick tips in place? I tried

$form[LANGUAGE_NONE][0]['format']['format']['#access'] = FALSE;

...but now the quick tips show the tips for ALL input filters, not just those enabled for anonymous comments!

Submitted by stephen on Thu, 2012-04-19 15:26

Hello there! This is my first comment here so I just wanted to give a quick shout out and tell you I genuinely enjoy reading through your articles and other information u provide here. Good work.

Submitted by charl on Fri, 2012-05-18 10:42

it seems work.

Submitted by bongo on Tue, 2012-06-05 21:41

Original post (option A) works great for me, using D7.14

Submitted by Gabor on Thu, 2012-08-09 10:17

Great! Works perfectly, thank you!

Submitted by R. Tayfun Gedik on Mon, 2012-12-31 17:21

It's work!


Submitted by Christopher Milne on Wed, 2013-01-23 06:34

I was not able to get Drupal to call the function 'hook_form_comment_form_alter' in option A from my theme's template php file and subsequently the callback function was not called.

Also, what do you mean by "Note ‘und’, you may need to set your comment form language code instead"?

Drupal 7.18

Submitted by Christopher Milne on Wed, 2013-01-23 07:12

look like i mistyped the hook name. please disregard my earlier comment.

this is a good solution. installing that module is overkill.

Submitted by sempepe on Fri, 2013-02-01 17:02

the most simplest solution i've implemented on code

'#title' => t('Whatever'),
'#type' => 'text_format',
'#base_type' => 'textarea',
'#description' => t('bla bla bla'),
'#format' => 'filtered_html',
'format' => array('access' => FALSE), // Hiding text options
'#default_value' => 'my_vaue',
'#required' => TRUE,

No hooks needed for drupal 7.15


Submitted by Sarah Opstaken on Tue, 2013-03-12 13:19

Hello Tim. I am working on a new Drupal site. Have been switching to Wordpress for a while because the learning curve was so steep with Drupal. Anyway, do you also charge per project/problem? I meet many developers charging per hour, which I understand but find less attractive than a fixed fee in case I run into problems. Warm regards, Sarah

Submitted by Tim on Thu, 2013-03-14 13:16

Hello Sarah,

feel free to contact me via contact form here: and we can discuss what you need to be done.

Submitted by JAScarb on Mon, 2013-06-03 19:32

Worked for me (option A), but I've no idea why. Anyone care to explain how adding a function without a call to it does anything, or point me in the direction of a resource? I guess I need to know more about hooks.

Submitted by John on Sat, 2013-09-28 17:49

This solution appears to kill tinymce editor. I used some css instead:

#edit-comment-body-und-0-format {
  display: none;

In most circumstances it should work. I've used it before when not using the tinymce text editor.

Add new comment

You are here