I am trying to disable comments on webform. I tried all settings I could find, but:

  • Link to comment form still appear
  • Name field and submit button still appear on comment form

Could somebody give me any advice?

13 Answers 13


As juampy wrote, node_revision should be updated as well. You need to execute 2 queries:

Step 1:

UPDATE node SET comment = 0 WHERE type = 'your_content_type'

Step 2:

UPDATE node_revision nrev
INNER JOIN node nd ON nrev.nid = nd.nid AND nd.type = 'your_content_type'
SET nrev.comment = 0

Step 3: Clear cache

  • 1
    And if you just installed something like Disqus then you can just run UPDATE node SET comment = 0; UPDATE node_revision SET comment = 0. Worked for me :-).
    – Nux
    Nov 22, 2013 at 2:40
  • If you need to remove comments from all node types just use @Nux queries.
    – albertski
    Jul 8, 2015 at 14:23

Sometimes it's easiest to just use SQL. This, I think, is one of those cases.

UPDATE node SET comment = 0 WHERE type = 'nocommentsforthistype';

0 = disabled

1 = readonly

2 = read/write.

  • 2
    0 = disabled, 1 = readonly, 2 = read/write. I think this is the best answer :)
    – AKS
    Dec 17, 2012 at 20:45
  • @AyeshK, nice i have edited the answer.
    – niksmac
    Feb 1, 2013 at 13:37
  • on one hand, if you know how to write/execute a query like this, you probably aren't struggling to figure out how to turn off comments, on the other hand, in terms of sheer speed/efficiency a db query based solution is WAY better than mine :) Jan 8, 2014 at 6:39

Changing the default comment settings for the content type, as suggested by uwe999 only changes the default settings for the content type. That means it won't retroactively change settings for existing content (as that could delete existing comments).

You will have to visit the node edit view for each existing node that you're trying to disable comments for and update the settings there. If you installed a module like the Node form columns module, which hides/removes elements from the node add/edit pages, then you will have to update its configuration the comment settings box appear for the nodes.


None of the above solutions worked for me. The comment form is still displayed in existing nodes unless you update node_revision as well.

Here is the hook_update_N() implementation that worked for me:

 * Implements hook_update_N().
 * Disables comments in existing event nodes.
function hook_update_7000(&$sandbox) {
  $content_type = 'event';

  // Update node table.
    ->fields(array('comment' => 1))
    ->condition('type', $content_type)

  // Update node_revision table.
  $nids = db_select('node', 'n')
    ->fields('n', array('nid'))
    ->condition('type', $content_type)
    ->fields(array('comment' => 1))
    ->condition('nid', $nids)

you disable comments in "structure / content types / [name of type] / edit / comment settings. Set "Default comment setting for new content" to hidden.

If you have existing comments you can delete them under "content /comments" or just unpublish them.

  • I did it, but link to form is still, propably only option is changing template or just pure css diplay: none, strange
    – Codium
    Sep 21, 2011 at 20:46
  • what template are you using?
    – uwe
    Sep 21, 2011 at 21:26

I'm not sure about your issue, but one dirty trick could be to create a special template for your content type and remove the comment parts.


Disable comments here first:

structure->content types->{node_type}->edit->comment settings

To update the nodes, unfortunately, you have to re-save each node. Use hook_update below:

 * Disable comments on node_type
function hook_update_N(&$sandbox) {
  $content_type = 'node_type';

  // Initialize batch.
  if (!isset($sandbox['total'])) {
    $query = db_select('node');
    $query->condition('type', $content_type);

    $sandbox['total'] = $query->execute()->fetchField();
    $sandbox['progress'] = 0;

    if (empty($sandbox['total'])) {
      $sandbox['#finished'] = 1;
      return t('No %type nodes exist in database.', array('%type' => $content_type));

  // Get and update nodes.
  $nids = db_select('node')
    ->fields('node', array('nid'))
    ->condition('type', $content_type)
    ->range(0, 10)

  if (!empty($nids)) {
    $nodes = node_load_multiple($nids, NULL, TRUE);

    foreach ($nodes as $node) {
      $node->comment = 1; // I set comments as 1 where value of 2 enables the comments.
      node_save($node);   // Re-save the node.

  // Increment & check progress.
  $sandbox['progress'] += count($nids);
  if (empty($nids) || $sandbox['progress'] >= $sandbox['total']) {
    $sandbox['#finished'] = 1;
    return t('Updated @count nodes.', array('@count' => $sandbox['progress']));
  else {
    $sandbox['#finished'] = $sandbox['progress'] / $sandbox['total'];

Do not forget to replace 'node_type' to your node type.


The simplest way to disable comments in the webform is to simply go to EDIT webform and in the bottom of EDIT option there is an option of Comments Settings.

By default its always OPEN so make it closed and the comment section from the webform will disappear...


You could use CSS to hide the comments section so that retrospective comments don't show.

Add CSS code to the Admin > Appearance > Advanced > Custom CSS tab. You would have to look at the class names of the divs for your specific site's page types. Here's an example from my test site which uses the News item page type (machine name "article"):

.node-article .comment-wrapper{
 visibility: hidden;
 display: none;

Use Views Bulk Operations, with the default operation: "Modify / Change Entity Values". Here you can set commenting to closed to existing nodes.


It's pretty straight forward, follow below steps:

  1. Navigate to Structure > Content Types > Webform
  2. Then Edit the webform and Click on Comment Settings in left hand side settings.
  3. Change the "Default comment setting for new content" value to 'Close' and save the setting.



I had this happen to about 50,000 records I imported into 4 different content types. I didn't want to erase and reimport or mess around with SQL queries in the database. If you want to remove commenting functionality from all nodes, just disable the comments module.


To disable comments in Drupal X you need to remove the field from the entity type.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.