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.

 

 

<?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' ) );
}
?>

Leave a comment