wp_update_menu_item
Update an existing WordPress menu item by renaming, moving, re-nesting, or retargeting it. Preview changes with dry-run before applying.
Instructions
Change one existing menu item: rename it, move it, re-nest it, or retarget it.
item_id is the menu ITEM id (from wp_list_menus -> the menu's items), not a page
id. Only the arguments you pass are changed - omit the rest and they are left
alone; passing none at all is refused rather than reported as a no-op success.
position is the item's menu_order (0 = first) and parent the id of the item to
nest under (0 = top level); url retargets a custom link (use wp_remove_menu_item
wp_add_menu_item to repoint an item at a different page). DEFAULTS TO dry_run=true (returns a preview of the exact fields; writes nothing). Pass dry_run=false to apply. Requires the REST transport. Prod writes require allow_prod=true.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | No | ||
| title | No | ||
| parent | No | ||
| dry_run | No | ||
| install | Yes | ||
| item_id | Yes | ||
| position | No | ||
| allow_prod | No |