How to disable comments in Drupal

Often Drupal (especially the older versions like 6.x) has problems with Spam bots which flood its comment modules.

The first thing to do in this case is to disable the comments modules until you clean all the Spam posts.

This can be done in two ways:

  • From your Drupal admin area

Login to your Drupal and go to Administer -> Content -> Content Types. Then edit the content type of your choice and make sure comments are set to OFF by default.

  • Executing an SQL query

Alternatively, the above can be done directly via phpMyAdmin by executing the SQL query below in your database:

UPDATE system SET status = '0' WHERE filename =  'modules/comment/comment.module';

When you decide to re-enable the module simply issue the reverse query:

UPDATE system SET status = '1' WHERE filename =  'modules/comment/comment.module';

A good choice for fighting spam bots is using a captcha module in combination with Akismet. This way you ensure that even if a bot passes your captcha module, Akismet will check the post against a huge spam database. Only after that the post will appear.

In case you are using Drupal 7.x/8.x you can disable the comments from your Admin area -> Structure -> Content Types -> Comment settings -> select Closed under the Default comment setting and save the changes.

You find this article useful? Click here to learn more about SiteGround web hosting experts and what else we can do for you!