Skip to content

Instantly share code, notes, and snippets.

@basvdheijden
Last active February 19, 2016 08:16
Show Gist options
  • Save basvdheijden/bbca4039323fd004f718 to your computer and use it in GitHub Desktop.
Save basvdheijden/bbca4039323fd004f718 to your computer and use it in GitHub Desktop.
<?php
$nodes = db_select('node', 'n')
->fields('n', array('nid'))
->condition('type', array('product'), 'NOT IN')
->execute()->fetchAll();
$nids = array();
foreach ($nodes as $node) {
$nids[] = $node->nid;
}
node_delete_multiple($nids);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment