0

I have created a menu and registered its location in functions.php

function register_my_menus() {
  register_nav_menus(
    array(
      'footer-menu' => __( 'Footer Menu' )     
    )
  );
}
add_action( 'init', 'register_my_menus' );

Then I added menu in footer.php

 <?php
    wp_nav_menu( array(
    'theme_location' => 'footer-menu',
    'menu_class'     => 'footer-links-menu',
    ) );
?>

The menu appeared in menu section and worked perfectly displaying sample page, custom link and sample post.

enter image description here

enter image description here

Now I unchecked the menu in back end. (Footer Menu)

The custom link and sample post are not coming. But the sample page link appears. Can some one help me if I am missing anything as the whole menu should not appear.

  • It is a default behavior of wordpress nav menu. You can select Footer Menu but delete all item from it to get rid of this issue. – Porosh Ahammed Sep 12 '17 at 5:05
1

This is controlled by the wp_nav_menu argument fallback_cb, which is the wp_page_menu function by default. Set it to false to show nothing in the case a menu isn't assigned.

wp_nav_menu( array(
    'theme_location' => 'footer-menu',
    'menu_class'     => 'footer-links-menu',
    'fallback_cb'    => false,
) );

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.