Create / Update Navigation Menu is a WordPress ability from Page Builder: Pagelayer – Drag and Drop website builder — usable via Easy MCP AI, which connects Claude, ChatGPT, and any AI assistant to your site.

Install Free Plugin →

Create / Update Navigation Menu

Write

Create a WordPress nav menu from a list of items (or rebuild an existing one of the same name), optionally with nested Mega Menu content, and assign it to a theme location.

Requires the Pagelayer plugin on WordPress 6.9+ (or another source of wp_register_ability()) for the Abilities API — registration is skipped entirely via a function_exists() guard when it isn't available, and ability categories similarly require wp_register_ability_category(). Most abilities require the 'edit_posts' capability; update-global-styles, create-menu, and delete-menu require 'manage_options'. search-images additionally needs a Pexels API key configured on the Pagelayer AI Agents settings page, and get-library-sections/import-library-section call Pagelayer's own hosted library API. Four near-duplicate abilities (get-widget, get-widgets-summary, edit-layout, navigator) are registered in source with mcp_public:false — fully callable over the REST Abilities API but intentionally left out of the advertised MCP tool list as duplicates of get-widget-schema, list-widgets, update-page, and get-page respectively — and are excluded from this listing.

What it does

Resolves or creates a nav menu by name, then, by default unless replace_items is false, deletes all its existing items and inserts the given items tree — supporting nested children, per-item link targets (page_id/post_id/url), and Pagelayer per-item settings where menu_type "mega" with mega_content builds a real Mega Menu dropdown stored as a serialized pl_nav_menu_item block on the item's post meta. Mega-menu bodies pass through the same inline-CSS scrub as any other layout content. Returns the resulting menu_id, expected to be placed in the pl_wp_menu widget's nav_list attribute, and assigns the menu to the given theme location when supplied. This ability requires the 'manage_options' capability, unlike most Pagelayer abilities which only need edit_posts.

See it in action

You ask your AI assistant

"Create a primary navigation menu with Home, About, Services, and Contact pages."

Inputs

Name Type Required Description
name string Yes Menu name, e.g. "Primary Menu". An existing menu with this name is reused.
location string No Optional theme menu location slug to assign this menu to.
replace_items boolean No Default true — the menu ends up containing exactly the items sent. false appends instead.
items array Yes Item objects: {title, page_id|post_id|url, target, children, menu_type, mega_content, mega_width, columns, col_gap, menu_icon, highlight_label, disable_link}.

Returns

An object with success (boolean), menu_id, name, items (the created tree with item_id per node), assigned_location, next_step (a hint string), and an optional failed array of per-item errors.

Permission

Requires the 'manage_options' capability.

Newsletter

The AI + WordPress space moves fast. Keep up.

New tools, workflow ideas, and product updates — be the first to know what's next.

No spam, unsubscribe anytime.