Delete a content type programmatically
Here is a real example of how a Content Type with "event" machine name is deleted.
// If the content type is added as the feature (optional).
module_disable(array('dennis_events'));
drupal_uninstall_modules(array('dennis_events'));
// Delete ALL Event nodes.
$query = db_select('node', 'n');
$query->fields('n', array('nid'));
$query->condition('n.type', 'event');
$nids = $query->execute()->fetchCol();
if (!empty($nids)) {
node_delete_multiple($nids);
}
// Delete the CT itself.
node_type_delete('event');
variable_del('node_preview_event');
drupal_set_message('The content type "Event" has been deleted.');
watchdog('node', 'Deleted content type "Event".', [], WATCHDOG_NOTICE);