I know that each menu item is simply post present in nav_menu_item
post type. It has has ID and can be removed with wp_delete_post()
but posts deleted this way don't remove menus present under [Appearance > Menus]. Only menu items are removed.
For instance I have "My Menu" under [Appearance > Menus] that has the following items: page-1, page-2, category-3. I can remove menu items with wp_delete_post()
but "My Menu" (group for those items) remains intact.
How can I programatically remove all defined Menus (and menu items)?
wp_delete_post()
but this doesn't remove "Menu Group" that they were in.