Showing the same menu in multiple location


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.

shuvonasir 4 years 2020-06-08T04:10:33-05:00 0 Answers 90 views 0

Leave an answer