0

Is there a "safe" way to delete all the existing content/pages/nodes from a Drupal 7 site, and delete corresponding menu entries? When I deleted the nodes using the admin UI, my menu entries didn't get deleted? What can cause this?

snapshot 1

snapshot 2

7
  • are you facing any issue if you delete it directly form the drupal admin? Commented Jan 28, 2013 at 4:16
  • Yes, the content from all the other menus is gone, but in the Administration it is still showing up (only when I go to structure/menus/list links though). What is the best practice when it comes to bulk deleting the existing nodes/content?
    – user12804
    Commented Jan 28, 2013 at 4:21
  • possible duplicate of Delete all nodes of a given content type Commented Jan 28, 2013 at 4:40
  • Thanks for that. I only had about 20 nodes all up, so deleting them via the interface wasn't an issue...
    – user12804
    Commented Jan 28, 2013 at 5:06
  • @user12804, then, your question should be updated what is your actual problem is. As your question was to delete all nodes, my answer below is the direct answer to it.
    – Sithu
    Commented Jan 28, 2013 at 5:19

1 Answer 1

0

These Q/A may be helpful for you:
Delete all nodes of a given content type
How to bulk delete content of a given type?
According to the first Q/A, the Delete all module is worth to try.

You could also try mass delete node. The function node_delete() is safe to call. It has a call to node_delete_multiple() which deletes all related components of a node, such as entities, files, revisions, history, etc.

[UPDATE]
If you already deleted your nodes, but node-related menus are still there, you could also try out menu_rebuild() to rebuild your navigation menus. Check this answer. You could also add menu_rebuild() at the end of the script of mass delete node I mentioned above.

OR

If you know menu IDs, you can remove each of them using menu_link_delete().

13
  • Thanks for that. I only had about 20 nodes all up, so deleting them via the interface wasn't an issue... The issue is that deleting them didn't remove them from the Navigation menu :S
    – user12804
    Commented Jan 28, 2013 at 5:05
  • Have you cleared caches?
    – Sithu
    Commented Jan 28, 2013 at 5:08
  • What is your navigation menu structure? Can you show us a screen shot? I believe that if a node has been deleted, the menu path point to the node is not valid anymore. They should be disappeared from the menu, or we can delete the menus manually by ourselves writing a script, just like mass delete node I mentioned.
    – Sithu
    Commented Jan 28, 2013 at 5:22

Your Answer

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

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