Customizing Menus for Logged-in Users in WordPress
Providing tailored content to your website visitors based on their interactions enhances the user experience and personalizes their journey on your WordPress site.
This personalization of content contributes to an improved user experience, creating a sense of individualized engagement.
While some websites may find it suitable to maintain uniform navigation menus across all visitors, others can significantly benefit from displaying custom menus to logged-in users.
For instance, online stores, WordPress membership sites, and online learning platforms can enhance user experience by offering personalized navigation menus to their logged-in users.
By implementing personalized navigation menus for logged-in users, they can easily access their account information, manage subscriptions, and access specific content they have enrolled in.
Although WordPress allows the creation of multiple navigation menus, it restricts showing only one menu at a particular location in your WordPress theme.
In the following sections, we will explore how to modify this default behavior and effectively present different menus to logged-in users in WordPress.
Creating Custom Menus for WordPress Users Based on Login Status
Regardless of the approach you choose, the initial step is to create two navigation menus—one for logged-in users and one for non-logged-in users.
To begin, navigate to the Appearance » Menus page within the WordPress dashboard. If you already have a navigation menu that serves all users on your website, it can be set as the default menu.
Next, click on the ‘create a new menu’ link to generate a new custom menu for your logged-in users.
Within this menu, you can add specific items that you wish to display exclusively to registered or logged-in users. For instance, you may want to include a logout link in this menu.
On the left-hand side of the screen, you will find a list of your website’s pages. To add a page to your menu, simply check the box next to the desired page and click the ‘Add to Menu’ button.
You can also rearrange the menu items on the right side of the screen by using the drag-and-drop feature.
Scrolling down the page, you can decide on a location to display your custom menu. However, you don’t need to assign a location at this stage; that will be done later in the article.
Remember to click on the ‘Save Menu’ button to preserve your changes.
For more comprehensive instructions on creating menus, refer to our beginner’s guide to WordPress navigation menus.
Method 1: Displaying Custom Menus for Logged-in Users in WordPress Using a Plugin
This method is recommended for all WordPress users as it is straightforward and user-friendly.
First, you need to install and activate the Conditional Menus plugin. For detailed instructions, refer to our step-by-step guide on how to install a WordPress plugin.
After activation, go to the Appearance » Menus page and switch to the ‘Manage Locations’ tab.
Here, you’ll find a list of available menu locations defined in your WordPress theme, along with the menus currently displayed.
For instance, the Primary Menu location is currently showing a navigation menu titled ‘Main Menu.’
Now, you need to instruct the plugin to display a different menu when specific conditions are met.
To do this, click on the ‘+ Conditional Menu’ link, and then select the navigation menu you want to show to logged-in users from the drop-down menu.
Next, click on the ‘+ Conditions’ link.
A popup will appear, offering a variety of conditions to choose from.
Simply check the box next to the ‘User logged in’ option, and then click on the Save button.
You can now visit your website to see the logged-in user menu in action. To view the navigation menu that will be shown to all other users, you can log out of your WordPress admin area.