Core Menus
A menu the client edits in WordPress
wp-menu="Header Menu" The navigation becomes a WordPress menu: the client adds, renames and reorders items in Appearance → Menus, and the links keep your design.
Where it goes
On the block that holds the links. The value is the menu’s name in WordPress, exactly as the client sees it in Appearance → Menus.
The items take the classes of the first link. Items with sub-items become a dropdown, two levels deep. For a dropdown of your own design use wp-menu-tree.
Example: the header menu
Markup index.html
<nav class="nav" wp-menu="Header Menu">
<a href="/" class="nav-link">Home</a>
<a href="/menu" class="nav-link">Menu</a>
<a href="/contacts" class="nav-link">Contacts</a>
</nav>In the admin Appearance → Menus
Header Menu
- Home
- Menu
- News
- Contacts
On the site every page
Home Menu News Contacts
Coffee for slow mornings
The client added “News” in the admin.
What matters
- No menu with this name yet: the block is empty. “Load data” creates the menu from the links in your markup.
- “Load data” rebuilds an existing menu from the markup: the client’s changes to that menu are replaced. Run it for menus once, at the start.
Alternative spelling
wp_menu works the same: the build gives an identical theme.