How to delete a vocabulary terms programmatically?
$tids = \Drupal::entityQuery('taxonomy_term')
    -&gt;condition('vid', 'mycustomvocab')
    -&gt;execute();

  $controller = \Drupal::entityTypeManager()-&gt;getStorage('taxonomy_term');
  $entities = $controller-&gt;loadMultiple($tids);
  $controller-&gt;delete($entities);