Skip to content

Instantly share code, notes, and snippets.

@billsinc
Created December 17, 2010 00:26
Show Gist options
  • Save billsinc/744277 to your computer and use it in GitHub Desktop.
Save billsinc/744277 to your computer and use it in GitHub Desktop.
Remove content from Drupal by content type
$node_type = 'lease';
//fetch the nodes we want to delete
$result = db_query("SELECT nid FROM {node} WHERE type='%s'",$node_type);
while ($row = db_fetch_object($result)){
node_delete($row->nid);
$deleted_count+=1;
}
//simple debug message so we can see what had been deleted.
drupal_set_message("$deleted_count nodes have been deleted");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment