jasonglisson
10/24/2014 - 5:50 PM

Drupal 7 - Delete all of a content type

Drupal 7 - Delete all of a content type

  $node_types = array('congressperson'); 
  // add the machine names of node types you want to bulk delete

  $query = new EntityFieldQuery();
  $query->entityCondition('entity_type', 'node')
    ->propertyCondition('type', $node_types, 'IN');
  $result = $query->execute();
  foreach($result['node'] as $node){
    node_delete($node->nid);
  }