Menu Location
A Menu Location in WordPress is a placeholder defined by theme developers where menus can be assigned by users via the admin panel. For example, a theme may define a primary
location for the main navigation and a footer
location for links in the footer. Menu locations let developers control where menus appear, while editors can freely assign or change menus without editing code.
How it works
- Declared in
functions.php
usingregister_nav_menus()
orregister_nav_menu()
. - Linked in the admin at Appearance → Menus → Manage Locations.
- Called in templates with
wp_nav_menu(['theme_location' => 'primary'])
.
Why it matters
Menu locations separate presentation (theme code) from content (menus defined by users). This allows flexible theme design while empowering site administrators to manage navigation easily.
Examples
// Register menu locations
register_nav_menus([
'primary' => 'Primary Menu',
'footer' => 'Footer Menu',
]);
// Display in theme
wp_nav_menu(['theme_location' => 'primary']);