Welcome to Praful Bhuskute BlackSpy Praful Bhuskute BlackSpy Praful Bhuskute BlackSpy Praful Bhuskute BlackSpy

How to Display different Menu to logged-in users in WordPress

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

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

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.

Drop your queries

Table of Contents

Have A Project In Mind? Let's Get To Work