I want to delete all taxonomy terms of particular vocabulary using entity_delete_multiple
. For node it is working fine
$result = \Drupal::entityQuery('node')
->condition('type', 'page')
->execute();
entity_delete_multiple('node', $result);
If i am changing taxonomy_term and type to tags or any other vocabulary
, or replaced type by bundle
$result = \Drupal::entityQuery('taxonomy_term')
->condition('type', 'tags')
->execute();
entity_delete_multiple('taxonomy_term', $result);
it is throwing error like this.
Drupal\Core\Entity\Query\QueryException: 'type' not found in Drupal\Core\Entity\Query\Sql\Tables->ensureEntityTable() (line 304 of core/lib/Drupal/Core/Entity/Query/Sql/Tables.php).
And also i need a same query to delete user(s), watchdog and profiles.
Is there any way to do it?
entity_delete_multiple
is deprecated in Drupal 8 and is simply not present in Drupal 9. Drush can always be used to accomplish the same end goal in a cross-major-version manner.drush entity:delete taxonomy_term --bundle=<the vocabulary bundle to delete>
will delete all terms in a specific vocabulary. Hope it helps! – Luke A. Leber Mar 7 at 16:56