0

I have deleted a Content Type called news some months ago using Drupal’s Field UI. Now I would like to recreate a new Content Type with the exact same machine name news. However no Content Type shows up. When I take a look at the database a new entry has been created in the node_type table.

Somehow Drupal doesn’t remove the Content Type in the database. What’s the recommended way to cleanup orphaned Content Types? Why does Drupal keep these leftovers? I don’t want to mess around in database.

3
  • Drupal doesn't keep "leftovers". When you delete a content type, it's gone. Modules are given the chance to clear up via a hook invocation, so maybe you're using a dodgy custom/contrib module. You can see what happens in node_type_delete. There's no room for ambiguity in there as I'm sure you'll see
    – Clive
    Commented Aug 22, 2016 at 11:48
  • No additional Contrib modules were involved. Only Drupal's Field UI.
    – user32010
    Commented Aug 22, 2016 at 11:51
  • As you can see from those few lines of code, the record is explicitly removed from the table, then the bundle is removed from the field system, the hook is invoked, and the cache is reset. Once cron has run to remove any to-be-deleted data, it's like it never existed as far as any core modules are concerned. Make sure your cron jobs are actually running and clearing out the old field data, other than that check any custom code you have in the site, as what you're describing doesn't line up with what Drupsl's core code is doing
    – Clive
    Commented Aug 22, 2016 at 12:01

1 Answer 1

1

You should delete the actual content first before deleting the content type. And nodes are going to be orphaned too and provably they will not display same as the content type news. can you try to search the existing news node in admin/content and check if you can still see the existing node type news that you created before. and try to delete them all before deleting the news content type and try to re-create the news content type.

5
  • Yes, I have deleted all Content first. No additional Contrib modules were involved. Somehow "news" is references in additional tables? I don't want to use a different machine name. What can I do?
    – user32010
    Commented Aug 22, 2016 at 10:45
  • I am not sure if this will work, I haven't tried it. run cron and clear your cache then try to re-create the content type news again.
    – narweidy
    Commented Aug 22, 2016 at 10:58
  • Thank you for your reply. I have cleared the cache and run update.php a couple of times. When I recreated the Content Type "news" it doesn't show up.
    – user32010
    Commented Aug 22, 2016 at 11:05
  • cron is different in update.php you can run cron here admin/config/system/cron
    – narweidy
    Commented Aug 22, 2016 at 11:07
  • Thanks, unfortunately news Content Type still doesn't show up.
    – user32010
    Commented Aug 22, 2016 at 11:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.