Home ›
Delete a content type programmatically in Drupal 7Delete a content type programmatically in Drupal 7
Submitted by Benjamin Melançon on February 15, 2012 - 10:06pm
Searched words:
drupal 7 programmatic delete content type
This is what i put as an update hook in a .install file:
<?php
/**
* Delete unused content types.
*
* Adapted from node_type_delete_confirm_submit().
*/
function anjaliup_update_7005() {
$types = array(
'simplenews',
);
foreach(
$types as $type) {
node_type_delete('simplenews');
variable_del('node_preview_' . $type);
}
node_types_rebuild();
menu_rebuild();
}
?>Not tested yet.
More like this
- Deleting Drupal Fields Programmatically (So As to Change Field Type with Features)
- Deleting the last content type containing a field deletes that field also
- Delete all nodes of a given content type with code ('cause, say, you're using Drupal 4.7)
- hook_help does not work on content type administration pages (Drupal 6)
- Disabling or moving node/add/[content-type] links from beneath "Add content" in the navigation menu also removes them from the Add content page (node/add)


Comments
Thank you, these help me :)
Thank you, these help me :)
Post new comment