How can I register multiple navigation menus in a WordPress theme?
Asked on Oct 02, 2025
Answer
To register multiple navigation menus in a WordPress theme, you need to use the `register_nav_menus` function within your theme's `functions.php` file. This function allows you to define multiple menu locations that can be managed through the WordPress dashboard.
<!-- BEGIN COPY / PASTE -->
function my_theme_setup() {
register_nav_menus(array(
'primary' => __('Primary Menu', 'textdomain'),
'footer' => __('Footer Menu', 'textdomain'),
));
}
add_action('after_setup_theme', 'my_theme_setup');
<!-- END COPY / PASTE -->Additional Comment:
- Ensure you replace 'textdomain' with your theme's actual text domain.
- After registering, you can assign menus to these locations under Appearance → Menus in the WordPress dashboard.
- Use `wp_nav_menu()` in your theme files to display these menus.
Recommended Links: