Deleting content types programmatically
$ournewtype = 'voucher';
$sql = 'SELECT nid FROM {node} n WHERE n.type = :type';
$result = db_query($sql, array(':type' =&gt; $ournewtype));
$nodeids = array();
foreach ($result as $row) {
  $nodeids[] = $row-&gt;nid;
}
node_delete_multiple($nodeids);
node_type_delete($ournewtype);