bricks_list_menus

Phase 1BeginnerRead OnlyComplexity: 2/10
List all WordPress navigation menus with items

Overview

Lists all WordPress navigation menus with their complete item hierarchies, assigned theme locations, and item counts. Each menu includes its items with title, URL, object type, and nested children for submenus.

Use this to discover existing menus before creating new ones, to find menu IDs for assignment to nav-menu elements, and to audit menu structures during the link reconciliation phase (Phase 4.7).

Key Features

Full Menu Hierarchy
Returns complete menu item trees including nested children for dropdown submenus.
Location Assignments
Shows which theme location each menu is assigned to (primary, footer, mobile, etc.).
Item Details
Each menu item includes title, URL, object type (page/post/custom), object ID, target, and CSS classes.

When to Use

During Phase 1 to discover existing navigation menus
Before creating a new menu to avoid duplicates
To find menu IDs needed for bricks_assign_menu_to_element
During Phase 4.7 link reconciliation to audit menu links
To verify menu structure after creating or updating menus
Prerequisites
No prerequisites — read-only tool

When NOT to Use

When you need to scan all links site-wide — use bricks_scan_links instead
When you need to check a specific page element — use bricks_get_page_content

Parameters

1 Total Parameters1 Optional
(none)noneoptional
This tool takes no input parameters. It returns all WordPress navigation menus with their items and locations.

Code Examples


Warning: Undefined array key "example_output" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 12

List All Navigation Menus

Returns all menus with their items, locations, and counts. Use the returned menu ID in bricks_assign_menu_to_element or bricks_delete_menu.

JSON
bricks_list_menus()

Common Mistakes


Warning: Undefined array key "fix_description" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 47

Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-includes/kses.php on line 2018

Warning: Undefined array key "wrong_code" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 48

Warning: Undefined array key "right_code" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 49
Always call bricks_list_menus first to avoid creating duplicate menus. WordPress allows multiple menus with the same name, which causes confusion.

Warning: Undefined array key "fix_description" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 47

Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-includes/kses.php on line 2018

Warning: Undefined array key "wrong_code" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 48

Warning: Undefined array key "right_code" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 49
The menu ID (term_id) identifies the menu itself. Menu item IDs (post IDs of nav_menu_item) identify individual items within the menu. Use the correct one for each tool.

Tips & Warnings

Tips & Warnings

Menu locations: Available theme locations depend on the active theme. Common Bricks locations include « primary », « footer », and « mobile ». Check bricks_get_site_context for available locations.

Link reconciliation: After creating all pages in Phase 4, menus created earlier may still have placeholder « # » URLs. Use bricks_scan_links to find and bricks_update_links to fix these stale links.

Return Values

FieldTypeDescription
menusarrayArray of menu objects with id, name, items, locations, and count
idnumberWordPress menu term_id
namestringMenu name
itemsarrayHierarchical array of menu items with nested children
locationsarrayTheme locations this menu is assigned to
countnumberTotal number of menu items

Related Tools

Technical Details

Tool ID
bricks_list_menus
API Endpoint
/menus
HTTP Method
GET
Namespace
wordpress-site
Source File
wordpress/menus.ts
Version
1.0
Min Bricks Version
1.9
Requires Auth
Yes

Changelog

v1.0
Initial release
20250101