Menu Toolswordpress_create_menu_item

wordpress_create_menu_item

Create a new menu item (page/post/category/custom URL) in a WordPress menu.

wordpress_create_menu_item

Create a new menu item. Can link to pages, posts, custom URLs, or categories.

Parameters

11 parameters, 2 required.

NameTypeRequiredWhat it is
menu_idnumberyesMenu ID
titlestringyesMenu item title
urlstringnoCustom URL (for custom links)
object_typestringnoObject type: "post", "page", "category", "custom", etc.
object_idnumbernoID of the linked object (post ID, page ID, etc.)
parentnumbernoParent menu item ID for nested items
positionnumbernoPosition in menu (1-based)
targetstringnoLink target ("_blank" for new window)
classesstringnoCSS classes (space-separated)
attr_titlestringnoTitle attribute (tooltip)
descriptionstringnoItem description

Example call

The smallest valid call, with the required parameters only:

{
  "name": "wordpress_create_menu_item",
  "arguments": {
    "menu_id": 123,
    "title": "Example title"
  }
}

Response

{
  "success": true,
  "item_id": 1005,
  "menu_id": 10
}

What it changes

It writes to the site. Respira takes a snapshot before the write, and the change can be undone from that snapshot for 90 days. Calling it twice does the work twice. On a connection set to read-only it is refused with respira_scope_denied.

How long it takes

A typical call takes about 1.9 seconds. 19 in 20 finish within 3.4 seconds. Measured on real sites over the last week, so it includes the site's own hosting.

Availability

Works on any WordPress site, whichever page builder it uses. Available since Respira 1.0.0.

Example Prompts

  • "Add a 'Contact' link to my primary menu pointing to /contact"
  • "Add page 42 to menu 10"
  • "Add an external link to the menu that opens in a new tab"