Define two menus and serve them based on if they are logged in or not which you can do in your theme’s functions.php
file:
if (is_user_logged_in()){
wp_nav_menu( array(
'menu' => 'Logged In Menu',
'container_class' => 'logged-in-menu',
'theme_location' => 'logged-in'
));
} else {
wp_nav_menu( array(
'menu' => 'Visitor Menu',
'container_class' => 'visitor-menu',
'theme_location' => 'visitor'
));
};
You’ll also need to register their theme locations which you can do in your theme’s functions.php
file as well:
register_nav_menus( array(
'logged-in' => __( 'Logged-in Menu Area', 'yourtheme' ),
'visitor' => __( 'Visitor Menu Area', 'yourtheme' ),
));
And you’ll have to assign those menus to their menu locations in the admin, like so: