How to Display different Menu to logged-in users in WordPress
you may have a WordPress membership or blogging website and you would like to display different navigation menus to logged in and logged out users.
Just follow the following steps to get a solution
Step 1: We create a different menu for login users in this step
In this step, we create a separate menu for login user
![](https://i0.wp.com/prafulbhuskute.com/wp-content/uploads/2021/12/How-to-Display-different-Menu-to-logged-in-users-in-WordPress-1.png?fit=1124%2C878&ssl=1)
Step 2: We create a different menu for Our website (For Non Login user ) in this step
In this step, we create a separate menu for All user on website
![How to Display different Menu to logged-in users in WordPress](https://i0.wp.com/prafulbhuskute.com/wp-content/uploads/2021/12/How-to-Display-different-Menu-to-logged-in-users-in-WordPress-2.png?fit=1124%2C878&ssl=1)
Step 3: In this step add the following code to function.php file of you theme
In this step, we create a separate menu for All user on website
function wp_wp_nav_menu_args($args = '')
{
if (is_user_logged_in()) {
$args['menu'] = 'logged-in';
} else {
$args['menu'] = 'primary-menu';
}
return $args;
}
add_filter('wp_nav_menu_args', 'wp_wp_nav_menu_args');
This method allows you to create two different menus for your users so that you can freely update your menus for logged-in or logged our users.