Today I have faced an weird problem regarding WordPress menus. Here is the register function of my menus -

function register_adaptive_menus() {
'top-menu' => __( 'Top Menu', 'adaptive-framework' ),
'main-menu' => __( 'Main Menu', 'adaptive-framework' )
add_action( 'init', 'register_adaptive_menus' );

And here's the two location where I've called those -

Location 1 :

<nav class="top-menu-navigation clearfix">
<?php wp_nav_menu(array(
'theme-location' => 'top-menu'
)); ?>

Location 2 :

<nav class="main-navigation clearfix">
<?php wp_nav_menu(array(
'theme-location' => 'main-menu'
)); ?>

So whenever I'm creating a menu for main menu it overrides the top menu that I've created in the backend of my WP installation and show same elements in both the location. Any idea why this is happening? Till I set Main Menu, both the location is receiving the same menu that I've set for the Top Menu.


There's a typo in your arguments. Instead of 'theme-location' it should be 'theme_location'. Here is the Codex as reference.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.