#31051 closed enhancement (duplicate)
Programmatically delete nav menu item
| Reported by: | virgodesign | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Menus | Version: | 4.1 |
| Severity: | normal | Keywords: | |
| Cc: | Focuses: |
Description
It seems that does not exist a direct fuction for deleting a nav menu item programmatically, using php.
Something such as wp_delete_nav_menu_item, a function that would delete a nav menu item from the database, correctly and definitely.
There is a question partially answered here:
Using wp_delete_post seems to be a workaround, as it will not update correctly all the databases entries that are involved.
Maybe a working solution could be:
- Delete the nav menu item from wp_posts using wp_delete_post (the 8 postmeta options involved will be also deleted).
- Delete the nav menu item from wp_term_relationships.
- Update the counter of the nav menu in wp_term_taxonomy.
I'm not sure if I'm missing something else, but I think this could be a staritng point. Any suggestions or comments would be very appreciated.
Change History (2)
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Duplicate of #29728.