Update Menu Item
wp_update_menu_itemUpdate a single menu item in place—rename, repoint, re-nest, or reorder—without rebuilding the menu, preserving IDs and avoiding orphaned rows.
Instructions
Update a single existing menu item IN PLACE — rename it, repoint it, re-nest it, or reorder it — without rebuilding the menu. Only the fields you pass are changed. Requires admin.
Prefer this over wp_build_menu for small edits. Rebuilding a menu regenerates EVERY item ID, which breaks anything referencing them and leaves orphaned rows behind; this changes one row.
Args:
item_id (number): Menu-item ID to update (from wp_list_menu_items). Required.
title (string): New label.
page_id (number): Repoint at this page ID. Mutually exclusive with url.
url (string): Repoint at this custom URL. Mutually exclusive with page_id.
parent (number): New parent item ID. 0 = top level.
menu_order (number): New position within its level.
target (enum): '' (same tab) | '_blank' (new tab).
description (string), attr_title (string), classes (string[]).
response_format (enum): markdown | json.
Returns: the updated menu item.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | No | Repoint at this custom URL (sets type=custom). Mutually exclusive with page_id. | |
| title | No | New label shown in the menu. | |
| parent | No | New parent menu-item ID for submenu nesting. 0 = top level. | |
| target | No | Link target: '_blank' opens in a new tab, '' opens in the same tab. | |
| classes | No | CSS classes applied to the menu item. | |
| item_id | Yes | Menu-item ID to update (from wp_list_menu_items). | |
| page_id | No | Repoint at this page ID (sets type=post_type, object=page). Mutually exclusive with url. | |
| attr_title | No | HTML title attribute for the link. | |
| menu_order | No | New position within its level (ascending). | |
| description | No | Menu-item description (rendered by some themes). | |
| response_format | No | Output format: 'markdown' for human-readable, 'json' for machine-readable. | markdown |