wp_delete_menu_item: delete a menu item
Removes an item from a navigation menu. Permanently — it does not go to the trash.
Arguments
| Argument | Required | Meaning |
|---|---|---|
item_id |
Yes | The menu item to remove |
dry_run |
No | Report without deleting |
Note it takes only the item ID. There is no menu_id, so nothing checks that the item belongs to the menu you had in mind.
Permissions
Allow content writes open, and edit_theme_options.
It removes the link, not the page
Deleting a menu item removes the navigation entry. The page, post or category it pointed at is untouched and remains on the site.
That makes this a much safer operation than it sounds — reversible in the sense that you can create the item again, though the position and hierarchy would need re-establishing.
Check for children first
The genuine hazard. Removing an item that has children beneath it leaves those children without a parent.
Depending on the theme they either disappear from the menu or promote to the top level, and neither is usually what was intended. A sub-item that jumps into the main navigation bar is very visible.
The item listing reports parent, so this is checkable before you act:
Show me the items in menu 3 with their IDs and parents. Does item 88 have any children?
If it does, decide what should happen to them — re-parent them first with wp_update_menu_item, or remove them too.
The dry run confirms the ID and nothing else
dry_run returns the item ID it would delete. It does not return the item's title, URL or children.
Since the tool takes no menu_id, the ID is the only thing identifying what you are removing — so read the listing first and confirm the title.
Show me item 88's title and URL. Then delete it.
Consider whether removal is what you want
Alternatives that are often better:
- Re-parent it into a less prominent position, if the goal is to de-emphasise rather than remove.
- Leave it and unpublish the target, if the goal is to take a page off the site — though that leaves a menu entry pointing at something invisible, so usually you want both.
Removing a menu item while leaving its page published makes the page unreachable through navigation but still live and indexed, which is a legitimate state and worth being deliberate about.
After deleting
- Open the site and look at the menu.
- Check no sub-items jumped to the top level.
- Check mobile.
- Purge the cache.
Multilingual sites
Each language's menu is separate. Deleting an item from one leaves the others intact, producing navigation that differs by language.
Common problems
| Symptom | Cause |
|---|---|
| The write is refused | Content write gate closed |
pom_ai_mcp_forbidden |
No edit_theme_options |
| Sub-items appeared in the main bar | Their parent was removed |
| The wrong item disappeared | No menu_id is checked; the ID was wrong |
| The menu looks unchanged | Cache not purged |
| The page is still reachable | Correct; only the link was removed |
Related
wp_get_menu_items— read before deletingwp_update_menu_item— re-parenting is often better- Edit a navigation menu