Drupal - How do I delete custom entity instances?

Drush 9 supports deleting custom entities drush entity:delete my_custom_entity


  1. You can use drush genc 0 —kill –types=article but you need to install devel_generate.
  2. You can also install Drush Delete All module available for drupal 8 module link

Delete all custom entities of a type:

Using Drupal Console (best method):

drupal entity:delete custom_type --all

Download and install Drush Delete All module and do:

drush delete-all-entity custom_type

which is the same as drush dae custom_type

Delete all nodes of a type:

Option 1: Using Drupal Console (best method):

drupal entity:delete node --all

Option 1: Download devel module and install devel_generate submodule You can then use drush (as per @shreya's answer) or the UI:

drush genc 0 —kill –types=article 

Option 2: Download and install Drush Delete All module and do:

drush delete-all article

Tags:

Entities

8