Home / login / Display different menus for logged-in users
  • How to Display different menus for logged-in users

    display-different-menus-for-logged-in-users

    Adding this snippet in the location you wish to display your navigation, would show one menu to logged-in users and another when they are not logged-in.

    ( click code to copy )

    wordpress snippet : PHP

    <>
    <?php
    if ( is_user_logged_in() ) {
         wp_nav_menu( array( 'theme_location' => 'logged-in-menu' ) );
    } else {
         wp_nav_menu( array( 'theme_location' => 'logged-out-menu' ) );
    }
    ?>
    

    ( WordPress codex functions, hooks, in this snippet. )

    is_user_logged_in, wp_nav_menu, _n, wp,