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?
-
are you facing any issue if you delete it directly form the drupal admin?– Mohammed ShameemCommented 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?– user12804Commented Jan 28, 2013 at 4:21
-
possible duplicate of Delete all nodes of a given content type– Patrick KennyCommented 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...– user12804Commented 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.– SithuCommented Jan 28, 2013 at 5:19
1 Answer
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().
-
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 Commented Jan 28, 2013 at 5:05
-
-
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.– SithuCommented Jan 28, 2013 at 5:22
-
imageshack.us/photo/my-images/546/screenshot20130128at354.png Commented Jan 28, 2013 at 5:25
-