Uninstalling a feature which creates a content type hides the "Delete" link on the admin/structure/types.

Issue on Drupal.org



Using a hook_uninstall() in FEATURE_NAME.install file and changing the status of the content type, so the system thinks it is an unlocked, custom content type.

I posted this also on d.org.

 * Implements hook_uninstall().
function FEATURE_NAME_uninstall() {

  // List custom content types added by this feature
  $custom_ctypes = array(

  // Go through each and unlock the content type
  foreach ($custom_ctypes as $ctype) {
    db_query("UPDATE {node_type} SET `custom` = 1, locked = 0 WHERE type = :ctype", array(':ctype' => $ctype));

  // Clean Drupal cache; this is necessary for the "Delete" link to appear
  // next to the content type created by the feature.


This will make the "Delete" button appear for that content type, so you can delete it from the admin.

Hope this helps someone!

| improve this answer | |
  • 1
    To clarify, this does not delete the content type; it makes the 'delete' link available in the content type listing page. Thanks @Ivanhoe123! – doub1ejack Feb 1 '13 at 18:50
  • 1
    Also, I was not able to do this while my features module was enabled, but after disabling & uninstalling (I used drush) this worked beautifully. Shortcut: use the devel module by dropping the contents of this function into /devel/php. To programmatically delete content type add node_type_delete($ctype); after the query in the for loop. – doub1ejack Feb 1 '13 at 19:05
  • Thanks for that code. After seeing this code i edited my database using phpMyAdmin and edited the "node_type" table. Then i found the contect type i waned to delete and set the "Custom" value to "1". And finnaly i deleted it from the Drupal Administration. – ANDiTKO Mar 9 '13 at 14:57
  • 2
    mysql> UPDATE node_type SET custom = 1, locked = 0 WHERE type = '<content type machine name>'; – Marco Lazzeri Feb 18 '14 at 20:00
  • @MarcoLazzeri's solution worked perfectly for me and was a lot better than having to update my feature module just to uninstall it. – donut Jul 30 '14 at 16:45

For me, the solution was to load the delete page manually since there is no "delete" link on the content types page. To do this, you just need to construct the URL yourself by following the same URL structure as the delete page for other content types:


This brought up the content type delete confirmation page, which then allowed me to delete the content type.

For reference, see this thread on Drupal.org:




| improve this answer | |
  • I just changed the display content type link at the end to delete and could remove the content type without a problem. This solution works! – cateye Mar 22 '14 at 9:22
  • Note: Before this would work I had to edit the feature's .info file and remove the content type, then it would actually delete. – Duncanmoo Oct 21 '14 at 10:47

The above method does not delete taxonomies, but this can be achieved by appending the following after disabling and uninstalling the module:

// Delete taxonomies.
$machine_names = array('taxonomy_a', 'taxonomy_b');
foreach ($machine_names as $machine_name) {
  $taxonomy = taxonomy_vocabulary_machine_name_load($machine_name);
| improve this answer | |

Another solution that worked for me directly to the database in my development site. Remember to always backup your database.

To manually delete a content type that was created by a feature #16 what Nedjo suggests is the following:

  • Disable the feature. I've sometimes run into problems with this--a feature won't disable. In this case, remove the feature module code.
  • Determine the machine name of the content type to be deleted, e.g., 'mytype'.
  • In the database, revert the node_type table values to the defaults as if the content type were created manually through the UI:

mysql> UPDATE node_type SET module = 'node', custom = 1, modified = 1, locked = 0 WHERE type = 'mytype';

  • Clear caches to ensure the content type change is available.
  • Through the UI at admin/structure/types, delete the content type.
| improve this answer | |

If you use admin_menu module, you will still see the delete links in pull-down menu Structure / Content types / [content type name] / Delete, even if they are not displayed on the content types page.

I would say it's pretty safe to use this delete link if you assure there are no other references to this content type anymore.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.