Remove Menu Item


Removes one item from a classic menu. Its child items are not left orphaned (as WordPress itself leaves them): they move up into its place, in order. Set remove_children to true to remove the whole branch instead, which needs confirm set to true. Classic menus have no revisions, so this cannot be undone automatically; the result lists everything removed with its link and position so it can be added back. The linked page itself is not touched.

Also known as: remove from menu, delete menu item, take out of the menu, remove menu link, remove submenu.

Property Value
Ability slug mosmcp/menu-remove-item
Wire tool name mosmcp__menu-remove-item
Category Menus & Navigation (mosmcp-menus)
Plan Free

 

Required access

Requirement Value
Capability edit_theme_options
Minimum default role Administrator (Shop manager too when WooCommerce is active)
Annotations readOnly: false · destructive: true · idempotent: true · openWorld: false

 

Input schema

Field Type Required Default Description
item_id integer Yes — The menu item to remove: an item_id from mosmcp/menu-get.
remove_children boolean false Also remove every item nested under it. Default false: they move up instead.
confirm boolean false Must be true when more than one item would be removed.

 

Output schema

Field Type Required Description
menu object Yes
menu.menu_id integer Yes Menu ID, accepted wherever a menu is asked for.
menu.name string Yes
menu.slug string
menu.description string
menu.item_count integer Published items in the menu.
menu.locations string[] Theme locations this menu is assigned to. Empty means the theme does not display it anywhere.
menu.auto_add_pages boolean Whether WordPress adds every newly published top-level page to this menu automatically.
removed object[] Yes Items removed, as they were before.
removed[].item_id integer The menu item's own ID, which every other menu ability takes. It is not the ID of the linked page.
removed[].label string Text shown in the menu.
removed[].uses_linked_title boolean True when the item has no label of its own and shows the linked page or category title, so renaming that page renames the item too.
removed[].type string "post_type" (a page, post or other content), "taxonomy" (a category, tag or other term), "post_type_archive", or "custom" (a typed address).
removed[].type_label string What wp-admin calls it, for example "Page", "Category" or "Custom Link".
removed[].object string The linked content type or taxonomy, for example "page", "post" or "category"; "custom" for custom links.
removed[].object_id integer ID of the linked page, post or term; 0 for custom links and archives.
removed[].url string
removed[].open_in_new_tab boolean
removed[].css_classes string[]
removed[].description string Item description; only some themes display it.
removed[].title_attribute string Tooltip text shown when hovering the link.
removed[].link_rel string Link relationship, for example "nofollow".
removed[].parent_item_id integer Item this one is nested under; 0 for the top level.
removed[].position integer 1-based position among the items that share the same parent.
removed[].depth integer 0 for top-level items, 1 for their children, and so on.
removed[].linked_status string For page and post links, the linked item's status (publish, draft, private, trash...) or "missing"; for term and archive links "ok" or "missing"; empty for custom links.
removed[].shown_to_visitors boolean False when WordPress hides the item from visitors because what it links to is gone or trashed, or because the item itself was never saved.
children_moved object[] Child items that moved up into the removed item's place.
children_moved[].item_id integer
children_moved[].label string
children_moved[].parent_item_id integer
children_moved[].position integer
children_moved[].depth integer
remaining_item_count integer
outline object[] The whole menu after the change, top to bottom, each child right after its parent.
outline[].item_id integer
outline[].label string
outline[].parent_item_id integer
outline[].position integer
outline[].depth integer
warnings object[] Non-fatal issues encountered while running.
warnings[].code string
warnings[].message string
warnings[].context string
notes string[]

 


<< Previous Next >>
List Navigation Menus Remove Navigation Link

For more information about the Secure MCP Server for WordPress plugin, explore the following resources:

Product Overview | Pricing | Try for Free | Documentation

If you have any questions regarding plugin configuration, pricing plans or licensing, please contact us or mail us at aisupport@xecurify.com.