bricks_delete_menu

Phase 3BeginnerDestructiveComplexity: 2/10
Delete a navigation menu

Overview

Deletes a WordPress navigation menu and all of its menu items permanently. This is a destructive operation that cannot be undone. The menu is removed from any assigned theme locations and all nav_menu_item posts associated with it are deleted.

Use bricks_list_menus first to find the correct menu ID and verify you are deleting the intended menu.

Key Features

Complete Removal
Deletes the menu term and all associated nav_menu_item posts in one operation.
Location Cleanup
Automatically unassigns the menu from any theme locations it was assigned to.

When to Use

To remove a menu that is no longer needed
When replacing an old menu with a completely new structure
To clean up duplicate or test menus created during development
Prerequisites
Call bricks_list_menus first to find the correct menu ID and confirm the menu you want to delete

When NOT to Use

When you want to modify menu items — use bricks_update_menu instead
When you want to unassign a menu from a location without deleting it — update the location assignment

Parameters

1 Total Parameters1 Required
menu_idnumberREQUIRED
WordPress menu ID (term_id) to delete. Find this via bricks_list_menus.

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

Delete a Menu by ID

Permanently deletes menu with ID 42 and all its items. Find the menu_id via bricks_list_menus first.

JSON
bricks_delete_menu({ menu_id: 42 })

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 1939

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
Nav-menu elements in templates may reference this menu. After deletion, those elements will show nothing. Update or remove the nav-menu elements in your header/footer templates after deleting their menu.

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 1939

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 parameter is the term_id of the menu itself (from bricks_list_menus), not the ID of an individual menu item.

Tips & Warnings

Tips & Warnings

Irreversible: Menu deletion cannot be undone. Always verify the menu ID using bricks_list_menus before deleting.

Template impact: If a deleted menu was assigned to a nav-menu element in a header or footer template, that element will render empty until a new menu is assigned via bricks_assign_menu_to_element.

Return Values

FieldTypeDescription
successbooleanWhether the menu was deleted successfully
messagestringConfirmation message

Related Tools

Technical Details

Tool ID
bricks_delete_menu
API Endpoint
/menus/{menu_id}
HTTP Method
DELETE
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