[Drupal] Deleting node content of a certain type in bulk
On occasions you may need to bulk delete all nodes of a certain type.
The following code requires 2 variables, the amount of rows to delete each time and the content type.
$amount = 100;
$type = ‘node_type’;
$result = db_query("SELECT nid FROM {node} WHERE type = ‘%s’ LIMIT %d", $type, $amount);
if (db_num_rows($result) && user_access(’administer nodes’)) {
$n [...]

Recent comments