Have you ever realized how confusing it can be for visitors to your WordPress site when they are logged in but still see ‘Login’ or ‘Register’ buttons everywhere? Perhaps your members are having difficulty locating their account dashboard because it’s hidden in the menu.
These minor frustrations can make even your most loyal users feel unwelcome on your own website.
A customized menu can significantly enhance the user experience. Displaying options like ‘My Account’ or ‘Logout’ for logged-in users instead of generic links makes your site feel more inviting and professional.
The good news is that creating dynamic menus in WordPress is simpler than you might expect.
In this guide, we will demonstrate two easy methods to show different menus to logged-in users, regardless of your skill level. 💡
Why Display Different Menus for Logged-in Users in WordPress?
Modifying various sections of your WordPress website based on your visitors and their activities creates a personalized experience for each user.
This tailored content enhances the overall user experience on your WordPress site.
If your website does not require users to register or log in, you can likely use the same navigation menus throughout your site. However, other websites can greatly benefit from displaying custom menus for logged-in users.
Websites such as online stores, e-learning platforms, and WordPress membership communities can greatly enhance user experience with customized navigation menus.
A tailored navigation menu for logged-in users simplifies their ability to access content and features they subscribed to.
For example, a customer on an online store can easily manage their account, while a member of a subscription-based community can quickly renew their membership or access exclusive online courses they have purchased.
WordPress allows you to create multiple navigation menus, but you can only display one menu in each designated location within your theme.
Before you can set up menus for logged-in users, you need to create two distinct navigation menus: one for logged-in users and another for logged-out users. Let’s get started.
⚠️Just a quick reminder!The techniques we are discussing are intended for users of WordPress classic themes. If you are utilizing a block theme with Full Site Editing (FSE) capabilities from WordPress 5.8 and later, these methods may not be applicable.
Creating Separate Menus for Logged-in and Logged-out Users in WordPress
To establish distinct menus for these two user categories, navigate to the Appearance » MenusAccess this section in your WordPress dashboard.
If you have an existing navigation menu that is used by all visitors to your website, this can serve as your default menu.
Next, click on the ‘create a new menu’ link to set up a custom menu specifically for your logged-in users.
Here, you can add menu items that you wish to display for registered or logged-in users. For instance, consider adding a logout link to your menu.
On the left side of the screen, you will find a list of your website’s pages. Simply check the box next to any page you want to include in your menu and click the ‘Add to Menu’ button.
You can also rearrange the menu items on the right side of the screen by dragging and dropping them.
Further down the page, you can select a location for your menu to appear. However, you don’t need to assign a location to this menu just yet; we’ll cover that later in the article.
Remember to click the ‘Save Menu’ button to apply your changes.
For more information on creating menus, check out our beginner’s guide to WordPress navigation menus.
You are now prepared to display different menus for logged-in users. Here’s a brief overview of the methods that will be discussed in this guide:
- Method 1: Display Different Menus for Logged-in Users in WordPress Using a Plugin
- Method 2: Manually Set the Logged-in Menu in WordPress Using Code
- Bonus Tip: Additional Use Cases for Conditional Logic in WordPress Menus
- FAQs: Displaying Different Menus for Logged-in Users in WordPress
- Additional Resources: Understanding WordPress User Roles and Site Navigation
Ready to enhance user experience? Let’s get started! 🌟
Method 1: Display Different Menus for Logged-in Users in WordPress Using a Plugin
The simplest way to display different menus for logged-in users is by using the Conditional Menus plugin. First, let’s install and activate it.
For detailed instructions, check out our step-by-step guide on installing a WordPress plugin.
After activation, navigate toAppearance » Menusin your WordPress dashboard. Then, go to the ‘Manage Locations’ tab.
Here, you’ll find a list of available menu locations defined by your WordPress theme along with the menus currently in use.
For instance, our ‘Primary Menu’ location is currently displaying a ‘Main Menu’.
Next, we need to configure the plugin to display a different menu based on specific conditions.
To get started, click on the ‘+ Conditional Menu’ link. From there, select the navigation menu you wish to display for logged-in users from the dropdown list.
Next, click on the ‘+ Conditions’ link.
A popup will appear, presenting you with various conditions to choose from.
Simply check the box next to the ‘User logged in’ option, and then click the ‘Save’ button.
Now, visit your website to see the menu designed for logged-in users. You can also log out of your WordPress admin to view the navigation menu that will be displayed to all other visitors.
Method 2: Manually Set the Logged-in Menu in WordPress Using Code
This method involves adding code to your WordPress site. If you’re unfamiliar with this process, check out our guide on how to copy and paste code snippets in WordPress.
Typically, tutorials suggest adding a code snippet to your theme’s functions.php file or a site-specific plugin. However, we advise against this method as it may lead to potential issues with your website.
Instead, consider using the WPCode plugin.
WPCode allows you to insert custom code snippets into your website without needing to modify your theme files directly. It also provides tools for managing these snippets and ensures they run safely, reducing the chances of disrupting your site.
ℹ️ Important: Among our partner brands, WPCode has been our preferred solution for adding custom snippets to enhance the functionality of each site. If you’re interested in learning more, check out our detailed WPCode review.
To begin, let’s install the WPCode plugin. You can start with the free version, which includes all the necessary features to display different menus for logged-in users.
However, if you want to unlock advanced features such as code revision history and scheduling for when snippets become active, consider upgrading to WPCode Pro.
After installation, navigate to Code Snippets »+ Add Snippets.
This will take you to WPCode’s code snippet gallery.
From there, click the ‘+ Add Custom Snippet’ button.
You will then be directed to WPCode’s text editor.
The next step is to provide a title for your code snippet and select ‘HTML snippet’ from the ‘Code Type’ dropdown menu.
Once you’ve done that, simply copy and paste the following code into the ‘Code Preview’ field:
function my_wp_nav_menu_args( $args = '' ) {
if( is_user_logged_in() ) {
// Menu for logged-in users
$args['menu'] = 43;
} else {
// Menu for visitors not logged in
$args['menu'] = 35;
}
return $args;
}
add_filter( 'wp_nav_menu_args', 'my_wp_nav_menu_args' );
Here’s an example of how it will appear in your WPCode editor:
Ensure that you replace 43 and 35 with the specific IDs of the navigation menus you created earlier.
To find the ID of a navigation menu, select it on the ‘Menus’ page. The menu ID number will be visible in your browser’s address bar.
Once you confirm all details are accurate, click the blue ‘Save Snippet’ button.
And that’s all there is to it!
Bonus Tip: Additional Use Cases for Conditional Logic in WordPress Menus
Conditional logic in navigation can do more than just display different menus for logged-in users. Here are a few quick examples:
- Display Different Menus Based on User Role: You can create distinct menus for different user roles, such as administrators and collaborators. For instance, display admin-exclusive options like site settings or user management for administrators, while providing general navigation links for collaborators and other user roles.
- Display Unique Menus on Various Pages: Do you want a customized menu for your blog page or product pages? By using conditional logic, you can establish specific menus for each page type, ensuring navigation is aligned with the content.
- Remove Navigation on Landing Pages: Landing pages are most effective when they are free of distractions. Utilize conditional logic to hide your navigation menu, directing focus towards your call-to-action, such as a sign-up form or product offer.
For further information, please check our guide on implementing conditional logic for menus in WordPress.
Frequently Asked Questions: Displaying Different Menus for Logged-In Users in WordPress
Do you still have questions about displaying different menus for users in WordPress? Here are some quick answers to assist you:
Is it possible to show different menus based on user roles?
Yes, you can present unique menus for Administrators, Editors, or any other custom user roles on your site. The Conditional Menus plugin offers a simple way to configure this, making it ideal for personalizing navigation for your team members.
Should I use a plugin or manually add code?
For most users, we suggest using a plugin like Conditional Menus or WPCode. These tools simplify the process of displaying different menus without modifying your theme files.
WPCode is particularly useful if you like the flexibility of coding. It allows you to safely insert custom PHP snippets and manage them directly from your WordPress dashboard, eliminating the need to editfunctions.phpmanually.
While manual coding is a viable option for developers, a plugin is the safer and more user-friendly choice for everyone else.
Is it possible to hide the navigation menu on specific pages?
Yes, you can apply the same conditional logic to hide your navigation menu on certain pages. This technique is commonly used for landing pages, as it minimizes distractions and keeps visitors focused on your call-to-action.
Further Reading: WordPress User Roles and Site Navigation
We hope this article has helped you understand how to easily display different navigation menus for logged-in users in WordPress. You may also be interested in our guides on:
- How to Enable User Registration on Your WordPress Site
- How to Allow Users to Invite Friends to Register on WordPress
- A Complete Guide to Moderating New User Registrations in WordPress
- How to Prevent WordPress From Forgetting Your Login with the Remember Me Feature
- Creating Personalized Welcome Messages for Each User in WordPress
- How to Limit Access to Your WordPress Forms for Logged-In Users Only
- Tips for Styling Navigation Menus in WordPress
- Top Membership Plugins for WordPress
If you enjoyed this article, consider subscribing to our YouTube Channel for WordPress video tutorials. You can also connect with us on Twitter and Facebook.



