wp_add_menu_item
Add a page or custom link to a WordPress navigation menu. Specify menu, target, title, and parent; use dry run to preview changes before applying.
Instructions
Add one item to a navigation menu (a site page, or a custom link).
menu is a menu id, or its EXACT name or slug (from wp_list_menus) - a reference
matching 0 or 2+ menus is refused and lists the available menus. Pass exactly one
target: page_id (from wp_find_page / wp_get_content) for a page on the site, or
url for a custom link. parent is the id of the menu item to nest under (0 =
top level); position is the item's menu_order (omit to append at the end).
DEFAULTS TO dry_run=true (returns a preview; writes nothing). Pass dry_run=false
to apply - the add is verified by reading the menu back. Requires the REST
transport. Prod writes require allow_prod=true.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"install": "<install>",
"menu": "<menu>",
"title": "<title>"
},
"name": "wp_add_menu_item"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | No | ||
| menu | Yes | ||
| title | Yes | ||
| parent | No | ||
| dry_run | No | ||
| install | Yes | ||
| page_id | No | ||
| position | No | ||
| allow_prod | No |