How to remove all terms from a taxonomy
You may need to delete all the terms of a taxonomy, either to replace them with a new list of terms, or under development to redo an import.
Delete terms with a Drush command
When there are a lot of terms, it can be quite cumbersome to do from the back office. There is a very simple Drush command that allows you to remove all terms:
on Drupal 8 or 9, run this command:
drush entity:delete taxonomy_term --bundle=VOCABULARY_ID
Replace VOCABULARY_ID with the machine name of the taxonomy vocabulary.
Example with a "Nationality" vocabulary with a machine name nationality.
drush entity:delete taxonomy_term --bundle=nationalite
The command returns the ids of the deleted terms
[success] Deleted taxonomy_term entity Ids: 201, 202, 203, 204, 205