Add Menu Item
wp_create_menu_itemAdd a menu item to a WordPress menu, linking to an existing page or custom URL, and set its position and parent for submenus.
Instructions
Add a single item to a menu. Link it to a page (page_id) or to a custom URL (url). Nest it by setting parent to another item's ID. Requires admin.
Args:
menu_id (number): Menu to add to.
title (string): Label.
page_id (number): Link to this page ID (or use url).
url (string): Custom URL (or use page_id).
parent (number): Parent item ID for nesting. 0 = top level.
menu_order (number): Position within its level.
response_format (enum): markdown | json.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | No | Custom URL (use instead of page_id for external/custom links). | |
| title | Yes | Label shown in the menu. | |
| parent | No | Parent menu-item ID for submenu nesting. 0 = top level. | |
| menu_id | Yes | Menu this item belongs to. | |
| page_id | No | Link to this page ID (sets type=post_type, object=page). | |
| menu_order | No | Position within its level (ascending). | |
| response_format | No | Output format: 'markdown' for human-readable, 'json' for machine-readable. | markdown |