Pedro Posada | Bulk delete nodes

Bulk delete nodes

Posted on March 4, 2009 - 11:41am
<< 22 of 50 >>

Insert snippet into a node's body. Select the php input format and submit the node.

I found it here: http://www.computerminds.co.uk/bulk-deleting-drupal-nodes-particular-con...

<?php
$node_type
= 'page';
 
 
//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)){
   
set_time_limit(20);
   
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");
?>

Post new comment

The content of this field is kept private and will not be shown publicly.
Please solve the math question. This way we will know you are not a robot.