Created
July 4, 2018 14:06
-
-
Save dakala/345ea89aa0b91bdadd9d64658b3bd0d8 to your computer and use it in GitHub Desktop.
Delete all terms in a vocabulary (Drupal 8)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$tids = \Drupal::entityQuery('taxonomy_term') | |
->condition('vid', 'VOCABULARY_ID') | |
->execute(); | |
$controller = \Drupal::entityTypeManager()->getStorage('taxonomy_term'); | |
$entities = $controller->loadMultiple($tids); | |
$controller->delete($entities); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment