Update Menu Item


Changes one classic menu item: its label, address, what it links to (post_id, term_id or archive_post_type to re-point it), new-tab setting, CSS classes, description, tooltip or rel, and optionally moves it (parent_item_id, position). Only the fields passed change; everything else on the item is kept exactly as it was. A label of "" makes a page link show the page's own title again. Passing url on a page link turns it into a custom link, and says so. item_id must be a menu item ID from mosmcp/menu-get, not a page ID. On a block theme, change header links with mosmcp/navigation-update-link instead.

Also known as: rename menu item, change menu link, edit menu item, open in new tab, move menu item, make submenu.

Property Value
Ability slug mosmcp/menu-update-item
Wire tool name mosmcp__menu-update-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: false · idempotent: true · openWorld: false

 

Input schema

Field Type Required Default Description
item_id integer Yes — The menu item to change: an item_id from mosmcp/menu-get (not the ID of the page it links to).
post_id integer — Link to this page, post or other public content, by its ID. The item follows the page if its address or title changes.
term_id integer — Link to this category, tag or other term, by its ID.
archive_post_type string — Link to the archive page of a content type, for example "product" for the shop page or "post" for the blog.
url string — Link to any other address: a full https:// address, a path on this site such as "/contact", an anchor such as "#pricing", or a mailto: or tel: link. Script addresses are refused.
label string — Text shown in the menu. Required for a url link. For page and category links it is optional: without one the item shows the page's own title and follows it when the page is renamed.
open_in_new_tab boolean —
css_classes string[] | string — CSS classes for the item, as a list or a space-separated string. Replaces the current classes; pass an empty list to clear them.
description string — Item description. Only some themes display it.
title_attribute string — Tooltip text shown when hovering the link.
link_rel string — Link relationship, for example "nofollow" or "noopener".
parent_item_id integer — Optional. Move the item under this item of the same menu, or 0 to move it to the top level.
position integer (min 1) — Optional. 1-based place among the items with the same (new) parent.

 

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.
item object Yes
item.item_id integer The menu item's own ID, which every other menu ability takes. It is not the ID of the linked page.
item.label string Text shown in the menu.
item.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.
item.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).
item.type_label string What wp-admin calls it, for example "Page", "Category" or "Custom Link".
item.object string The linked content type or taxonomy, for example "page", "post" or "category"; "custom" for custom links.
item.object_id integer ID of the linked page, post or term; 0 for custom links and archives.
item.url string
item.open_in_new_tab boolean
item.css_classes string[]
item.description string Item description; only some themes display it.
item.title_attribute string Tooltip text shown when hovering the link.
item.link_rel string Link relationship, for example "nofollow".
item.parent_item_id integer Item this one is nested under; 0 for the top level.
item.position integer 1-based position among the items that share the same parent.
item.depth integer 0 for top-level items, 1 for their children, and so on.
item.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.
item.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.
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[]
changed_fields string[] Fields whose stored value actually changed.

 


<< Previous Next >>
Undo Navigation Change Update 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.