How to Show or Hide Menu Items on Certain Conditions in WordPress

category WordPressPin

Every website has navigation menu items. They help webmasters to divert visitors to certain category-related posts or pages on the site. The items are common in most cases. It means, everyone who is engaged with the site will see the same menu irrespective of their user roles and pages opened.

How to show different menus based on the user roles, pages, and device types in WordPress?

Do you want to show some menu items to logged-in users only and hide them from normal visitors to the site?

We’ll show you how to do that. You have to apply certain conditions to manage menu items in WordPress.

Show and hide menu items in WordPress

Sign in to your WordPress site, visit Plugins > Add New. Search for If Menu plugin.

Hide WordPress menuPin

Install and activate the plugin.

Go to Appearance and Menus to customize your menu items. Open each item in the menu structure to view the plugin tools.

Check Enable conditional logic box to configure the item appearance.

menu items WordPressPin

Choose Show or hide from the first drop-down box. It instructs the plugin to show/hide the chosen menu item if the following conditions are matched. Set your condition in the next box.

menu items WordPressPin

If Menu lets you customize the menu based on the user roles, page types and devices. Choose your primary condition and if you want to use it with the combination of another, select And or Or from the third box. The next line of conditions will be added automatically. Fill them. Repeat these steps for all menu items and Save.

If Menu is highly flexible, easy to use and can be used to manage menus in several ways. You can create so many items as you want and arrange them across different page types or according to the own custom conditions opted.

Hide WordPress Menu by User-Roles

Hide WordPress menuPin

Nav Menu Roles is another popular plugin to hide menu items based on user roles. So you can show some items to certain users only and hide the same from others as well.

After installing, go to Menus to manage item visibility. Set Display mode for each item regardless of the reader’s role on the site. Show it for all users or just logged in/logged out users.

menu items WordPressPin

For deeper customization, go to the next option where you can restrict the item according to the minimum user roles. The plugin doesn’t limit the item visibility strictly to that role but considering it as the minimum base role in the site. An Administrator is able to view all items even though they are restricted to the subscribers. Because he or she has powers of all other user roles. In the same way, other users who are above the subscriber role too can view the same item.

Read 10 Best WordPress Security Tips to Protect Your Website in 2021

Learn how to build traffic and make money from your blog

Sign Up for

Blogging & SEO tips

Leave a Comment

Your email address will not be published. Required fields are marked *

9 − 6 =

Hello, I'm Manoj!

Get our latest blog post tips & money saving deals in your inbox (No spamming- promise)

Host Your Website on Google Cloud Connected Servers with Cloudflare Enterprise CDN