If you’ve ever wanted to show a different menu item in WordPress, or hide a navigation menu item based on a user role, then you’ll want to check out my review of the Nav Menu Roles WordPress plugin.
About the Nav Menu Roles WordPress plugin
It’s an exciting concept, and for those who use a membership plugin or e-Commerce solution, this could be of significant interest to you.
With over one million downloads on WordPress.org and over 100,000 active installations, it seems I’m not alone in thinking this plugin is useful.
It’s also worth noting; Nav Menu Roles is entirely free to use and download.
Why would you show or hide a WordPress navigation menu item?
It’s important to understand why you’d even consider doing this, and there’s a few reasons for doing so such as:
- You’re running an online store (maybe with WooCommerce or Easy Digital Downloads) and want a cleaner menu structure, for example.
- You’re running a membership website using WordPress and a membership plugin and want to clean up the menu system.
There are probably even more reasons, off the top of my head, that’s all I’ve got so far—sorry brain freeze.
Installing the Nav Menu Roles plugin
Navigate to your WordPress backend, enter Nav Menu Roles, hit install, and that’s it. Or, if you prefer, you can grab it from the WordPress repo here.
Where are the settings for it?
Quite a few plugins have their own settings panel, and you might be a little lost at first. Don’t worry. Sensibly the settings reside in the menu section.
Go to Appearance > Menus in your WordPress backend.
Settings for Nav Menu Roles WordPress plugin
I’ve just created a basic menu to show what the plugin offers. By clicking on the menu item ‘Home’ in my case, you will find some new additions under the name ‘Display Mode.’
Let’s take a look at what each one does, respectively.
Logged in user settings
As the name would suggest, this will display the menu item to logged-in users; user role choices are listed below. All you have to do is click the specific user role you’d like the menu item to show for.
Logged out users and everyone
There are no additional settings for either of these two options, and why would you need one?
‘Logged out users’ is as simple as the name suggest, show that specific menu item to anyone logged out of your site. Or select ‘everyone’ so all visitors, no matter whether logged in or not can view the menu item.
*Important to remember
The plugin lets you hide menu items based on user roles; however, it does not restrict access to the content itself. If you need to limit access to specific content, then you’ll need to install a plugin to handle that.
That’s the review
Not much of a review granted. The plugin does exactly what it says on the tin. I could stop there and tell you it performs very well indeed, super simple to use, and don’t forget it’s free.
Where’s the fun in that? How about I show you a little something, maybe a mini-tutorial? A real-world usage scenario?
Sound good? Let’s take WooCommerce for example, in the next section I’m going to show you how to make a custom WooCommerce menu along with why.
Making a custom menu in WooCommerce
For this part I’m going to install WooCommerce, I want to show you a real example of how the plugin could be of benefit. (Slopes off to install WooCommerce add a few products and other bits and pieces.)
WooCommerce’s new install method was fun lol. I digress, the above is a screenshot displaying a menu I whipped up. Nothing fancy here, I added a bog-standard menu, with the default Nav Menu Roles setting, which is to display for everyone.
I’m in the product itself (apologies for my lack of imagination regarding the product!), as you can see, the nav menu is on display.
How to hide a WordPress navigation menu item
For this example, I’m going to hide the ‘About’ menu item; all we have to do is go back to our menu settings in Appearance.
I’ve selected ‘Editor‘ under the Logged In Users setting. So what does that do to the front end, considering I’m an Administrator, not an Editor?
Well, the About menu item has gone, as the user role is set to Editor, not everyone. It will only show to users who have the user role of Editor. So very basic at the moment and not very sexy, I guess.
Let’s get sexy with it.
How to make a custom menu in WooCommerce
First, let’s take a moment and think about this logically. If you’re running a WooCommere store or indeed using a membership plugin, you might not want to have complicated menus in place.
You’ll more than likely want to keep things simple. Using WooCommerce and all the pages it creates and endpoints, it can be a bit of a mess to a visitor if, of course, you wanted to display all of them at once.
Logged in links, Logged out links, My Account, Cart, the list goes on and on. All useful, let’s put it into a way our customer/visitor can understand.
Narrowing down menu items based on logged out users
We want things to be super easy for our visitors, so narrowing down the menu items when it comes to WooCommerce makes sense.
It leads to a cleaner experience, the easier, the better. Take a look at the menu I’ve created below.
As you can see, I’ve made the following available to logged out users:
- Home, About, Shop & Register / Login
Why Register / Login? I think this is a cleaner way of doing things, having the menu item as My Account is a little ambiguous, especially if you don’t already have an account.
I want my visitors to see how clear it is that they can register for an account or login if they have an existing one.
The second part of the menu deals with ‘Logged In Users.’ I’ve defined the user role as ‘Customer’ in the menu settings for each menu item. So these menu items will only display to those who are, in fact, a ‘Customer.’
Lastly, on the image, you’ll probably have noticed the menu item ‘Logout.’
Why have I done this? For me, it’s cleaner to have it outside of the ‘My Account’ menu item as a submenu, it’s more evident that a user can logout if and when they need to.
Remember, not every visitor has used WooCommerce as a shop front to purchase online, so helping users with navigation is a sure-fire way to be remembered as having an easy to use online store.
Putting it all together, what does our custom WooCommerce menu look like?
First up, let’s view the menu I’ve created as a logged-out user, note the Register / Login menu item? Now let’s look at the menu from a ‘Customer’ user role.
Well, Register / Login is now gone, and we are left with a cleaner experience for our visitors, with the apparent Logout link.
All possible thanks to the Nav Menu Roles WordPress plugin
I could go on and on, and tell you a bunch more possibilities with the Nav Menu Roles plugin, I think you’ve got the gist by now. Take it for a spin, see what you can come up with.
|Criteria||Score (Out Of 5)|
|Ease of use||5|
|Final Review Score||5|
Perfect for creating a cleaner menu structure based on a user role, so ideal for WooCommerce, and whatever platform you use for membership.
Kathy Darling has created an awesome plugin here, and I thank her for taking the time out to make something so useful.