3

Is there a way to disable the core Comment module in Drupal 8? The module is enabled by default, but I prefer not to use Drupal comment system and would like to not have it clutter up the GUI for site builders.

I do understand that disabling a module in Drupal 8 is the same as removing it -- perhaps that's why most core modules can't be disabled.

3 Answers 3

13

In Drupal 8, you cannot anymore disable modules. You can only uninstall a module, but in the case of the Comment module, you first need to remove any Comments field. In fact, on /admin/modules/uninstall you will see the following message:

The following reason prevents Comment from being uninstalled:

  • The Comments field type is used in the following field: node.comment

By default, the Comments field is added to every content type.

screenshot

Once you remove that field from every content type, you will be able to uninstall the Comment module from a Drupal 8 site, if there isn't any module that depends from the Comment module. Otherwise, you first need to uninstall first those modules.

As for updating Drupal, updating Drupal doesn't install the core modules you previously uninstalled, not even the ones the profiles you used to install Drupal would install.

3
  • 1
    Thank you. I was missing one piece of information: I had to remove the comment field from the Article content type first. Considering that most developers I know stay far away from the Drupal comments functionality, I cannot understand why this was baked in as enabled by default.
    – David Feld
    Commented Jun 27, 2016 at 16:39
  • 1
    Because it's a core module, does that mean it will be reinstalled (perhaps enabled) when I do the next core update?
    – David Feld
    Commented Jun 27, 2016 at 16:43
  • 2
    If you uninstall it, and you update Drupal, the Comment module will not be reinstalled.
    – avpaderno
    Commented Jun 27, 2016 at 16:45
6

Through Drush

drush ev '\Drupal::service("entity_field.manager")->getFieldStorageDefinitions("node")["comment"]->delete();'
drush cron
drush pmu comment
1
  • Magnificent solution. Worked perfectly
    – JFC
    Commented Aug 16, 2018 at 16:52
0

Yes, you can disable the comment module once every use of the comment fields have been remove.

But you can't uninstall this module in Drupal 8.

For the long answer, see this post : https://www.drupal.org/node/2225029

Even if you removed all the "comment" fields you wouldn't be able to uninstall the comment module.

1
  • Actually, the OP got confused between disable a module, and uninstall it. Drupal 8 allows just to uninstall a module, not disable it. So, it's not true it is not possible to uninstall the Comment module. You need to remove any comment field, and uninstall every module that depends from the Comment module.
    – avpaderno
    Commented Sep 28, 2017 at 4:26

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.