WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Newly created menu automatically add all pages to it when a menu is not assigned (3 posts)

  1. Majon
    Member
    Posted 1 year ago #

    Hi,

    I think I'm trying it wrong. I've created a new menu at a theme location using below code.

    wp_nav_menu( array( 'sort_column' => 'menu_order', 'container_id' => 'rockbottomnav' , 'menu_class' => 'rockbottom-menu', 'theme_location' => 'rockbottomnav') );

    Everything works fine. But I'm wondering if it's possible to not show all pages listed automatically on that navigation when that navigation is not assigned a menu via theme locations under menus. I'm sure this is possible but I just can't seem to get it working.

    Thank you so much in advance.

  2. paulwpxp
    Font hero
    Posted 1 year ago #

    That's because the default 'fallback_cb' is set to 'wp_page_menu'.

    So you could try adding this 'fallback_cb' => '__return_false'.

  3. Majon
    Member
    Posted 1 year ago #

    Well my dear friend I can't thank you enough. It's quite simple but I'll be remembering this until it is deprecated.

Topic Closed

This topic has been closed to new replies.

About this Topic