Why do i have duplicated menu on wordpress?

Here i am creating 2 menu sites “Main” and “Central”

 if ( function_exists( 'register_nav_menus' ) ) {
     register_nav_menus(
          array(
              'main' => 'Main',
              'central' => 'Central' 
         )
     );
  }

when i am creating menus on wordpress aperience, menus
and i am puting them on their sites
PRS menu on Main
and central on Central

Read More

When i have incerted my menus on web

       <?php wp_nav_menu( array('menu' => 'Main','menu_class' => 'menu' )); ?>
       <?php wp_nav_menu( array('menu' => 'Central','menu_class' => 'menu' )); ?>

But on my web i am seyng “central” menu 2 times and PRS dont apear.
What is the problem and what solution cn i find?

Related posts

Leave a Reply

1 comment

  1. Try single Register this way & then move on to array – add code below to functions.php:

    WP Codex register_nav_menu

    <?php
    add_action( 'after_setup_theme', 'register_my_menu' );
    function register_my_menu() {
      register_nav_menu( 'primary', 'Primary Menu' );
    }
    ?>
    

    Display menu on page – add to header.php:

    WP Codex wp_nav_menu

    <?php
    
    $defaults = array(
        'theme_location'  => 'primary',
        'menu'            => 'Primary Menu',
        'container'       => 'div',
        'container_class' => '',
        'container_id'    => '',
        'menu_class'      => 'menu',
        'menu_id'         => '',
        'echo'            => true,
        'fallback_cb'     => 'wp_page_menu',
        'before'          => '',
        'after'           => '',
        'link_before'     => '',
        'link_after'      => '',
        'items_wrap'      => '<ul id="%1$s" class="%2$s">%3$s</ul>',
        'depth'           => 0,
        'walker'          => ''
    );
    
    wp_nav_menu( $defaults );
    
    ?>
    

    Tip – both of your entries have a ‘menu’ class:

    Your code:

     <?php wp_nav_menu( array('menu' => 'Main','menu_class' => 'menu' )); ?>
    

    Change to:

     <?php wp_nav_menu( array('menu' => 'Main' )); ?>