Pular para o conteúdo principal

Create Menu

The Create Menu ability creates WordPress navigation menus with support for distinct navigation labels separate from page titles.

Overview

This ability extends the standard menu creation functionality with the ability to specify a navigation_label parameter. This allows you to create menus where the label displayed in navigation differs from the page title, providing more flexibility in site structure and user experience.

Parameters

ParameterTypeRequiredDescription
namestringYesMenu name, e.g. Primary Navigation
locationstringNoTheme location to assign this menu to, e.g. primary
navigation_labelstringNoLabel to display in navigation (distinct from page title)

Return Value

{
"success": true,
"menu_id": 7,
"name": "Primary Navigation",
"navigation_label": "Main Menu"
}

The navigation_label parameter allows you to separate the internal menu name from the label displayed to users:

  • name — Internal menu identifier used by WordPress (e.g., "Primary Navigation")
  • navigation_label — The label displayed to site visitors in the navigation (e.g., "Main Menu")

This is useful when:

  • Your internal naming convention differs from user-facing labels
  • You want shorter labels in navigation than in the admin panel
  • You need to support multiple languages with different label lengths
  • You're building menus for specific regions or user groups

Usage Examples

Example 1: Simple Menu with Navigation Label

Prompt:

Create a primary navigation menu called "Main Navigation" with the navigation label "Menu".

Result:

{
"success": true,
"menu_id": 7,
"name": "Main Navigation",
"navigation_label": "Menu"
}

Example 2: Menu for Specific Theme Location

Prompt:

Create a footer menu called "Footer Links" with navigation label "Quick Links" and assign it to the footer location.

Result:

{
"success": true,
"menu_id": 8,
"name": "Footer Links",
"navigation_label": "Quick Links",
"location": "footer"
}

Integration with Theme Builder

When using Theme Builder, the Create Menu ability:

  1. Automatically detects available theme menu locations
  2. Creates menus with appropriate navigation labels for your design
  3. Assigns menus to the correct theme locations
  4. Supports adding menu items after creation
  • add_menu_item — Add items to an existing menu
  • update_menu — Rename a menu or reassign it to a theme location
  • delete_menu — Remove a menu from your site

Best Practices

  • Use clear navigation labels — keep labels concise and descriptive for users
  • Match theme locations — assign menus to the correct theme location for proper display
  • Plan menu structure — decide on your menu hierarchy before creating items
  • Test responsiveness — verify menus display correctly on mobile devices
  • Localize labels — use different navigation labels for different language versions

Limitations

  • Navigation labels are display-only; the internal name is still used for WordPress identification
  • Theme support varies; not all themes support all menu locations
  • Menu items must be added separately after menu creation
  • Changing a navigation label requires updating the menu