How to Implement Conditional Logic in WordPress Menus

Table of contents
WordPress shows the same menu to every visitor. To add conditions, use a plugin. To show or hide single menu items for logged-in users, logged-out visitors or specific roles, install a free plugin such as User Menus, Nav Menu Roles or If Menu: each adds a visibility option to every item under Appearance > Menus. To swap a whole menu on certain pages, posts or archives, use Conditional Menus. If your header is built with Elementor, you can also put two menu widgets in it and show each to a different audience with Visibility Logic for Elementor.
Which one fits depends on the question you are answering: “which items does this person see?” or “which menu does this page get?”. Below is each approach, with the limits that matter.
Three common cases
| You want | Best fit |
|---|---|
| “Log in” for visitors, “My account” for members, in the same menu | A per-item plugin: User Menus, Nav Menu Roles or If Menu |
| A different menu on the shop, the blog or one landing page | Conditional Menus |
| A completely different header for members and visitors, built in Elementor | Two Elementor menu widgets with Visibility Logic rules |
All plugins below are free on WordPress.org. The active install counts and update dates were checked on WordPress.org on 16 November 2026.
Option 1: Hide or show single menu items
This covers most cases, because it keeps one menu and only changes what each person sees.
User Menus
User Menus (80,000+ active installs) adds a “Who can see this link?” choice to each menu item: everyone, logged-out users or logged-in users, and for logged-in users the roles that can or cannot see it. It also adds login, logout and register links you can put in a menu, and can show user details such as the username or avatar in a menu label.
- Go to Appearance > Menus and expand a menu item.
- Under Who can see this link?, choose Logged In Users or Logged Out Users.
- For logged-in users, tick the roles if only some should see the item.
- Save the menu.
Nav Menu Roles
Nav Menu Roles (70,000+ active installs) does the same job with a Target audience setting on each item: everyone, logged-in users or logged-out users, with role checkboxes for logged-in users. Developers can add their own criteria through filters.
If Menu
If Menu (50,000+ active installs) adds visibility rules per item: logged-in state, user role, page type and mobile devices, with rules you can combine. A paid add-on adds location, language and membership rules. Note that its last update on WordPress.org was in December 2024, so check that it works with your WordPress version before you rely on it.
Option 2: Swap the whole menu by page
Conditional Menus by Themify (60,000+ active installs) replaces the menu in a theme location under conditions: different menus on different posts, pages, categories or archive pages.
- Create the menus you need under Appearance > Menus, on the Edit Menus tab.
- Open the Manage Locations tab. Next to each theme location there is a Conditional Menu link.
- Click it, select the menu to swap in, then click + Conditions and tick where it should appear.
- Save the changes.
It works with themes that use the standard WordPress menu function, which most classic themes do.
Option 3: An Elementor header with Visibility Logic
If your header, footer or sidebar is built with Elementor (for example with Elementor Pro’s Theme Builder), you do not need a menu plugin to give members and visitors different navigation. Visibility Logic works on any Elementor widget, menu widgets included.
- Create two menus under Appearance > Menus, for example “Visitor menu” and “Member menu”.
- In the Elementor header template, add two menu widgets next to each other, one per menu.
- Select the first, open the Visibility tab, switch on Enable Visibility Logic, set Show/Hide action to Show, enable User Role and pick Guests.
- Do the same on the second with Logged in users.
- Update the template and check the site logged in and in a private window.
The free plugin also has Device Type, so you can serve a short menu to phones and a full one to desktops, and Date Time for a menu link that appears only during a sale. With Visibility Logic Pro, the Conditional Tags and Post/Page conditions add page-based rules, such as a different menu on WooCommerce pages.
Two things to know about this approach. Visibility Logic controls the whole widget, not single items inside a menu: for item-level rules, use one of the plugins in Option 1. And a hidden widget is left out of the page HTML, so visitors do not receive the menu that is not meant for them. The full walkthrough for user roles is in How to show or hide Elementor content by user role.
Things that catch people out
- Hiding a menu item does not protect the page. The page behind a hidden link is still reachable by anyone with the URL. Protect the page itself with a membership plugin, or by a login requirement.
- Caching. Menus that change with login state work with most page caches, because those caches skip logged-in users. Menus that change by device or date need your cache configured for it. The Visibility Logic troubleshooting page lists what to exclude.
- Theme menus outside Appearance > Menus. Some themes and page builders render their own menus. A per-item plugin only affects menus that WordPress builds from Appearance > Menus.
Free or Pro?
Every menu plugin above is free. Visibility Logic for Elementor is free on WordPress.org and includes User Role, User Meta, Date Time, Browser Type, Device Type and ACF Field. Visibility Logic Pro adds page, location, language and shop conditions, and fallback content; it costs $29 per year for 1 site, $39 for 3 sites and $79 for 100 sites. See the Free vs Pro table.
The short version
For “different items for members and visitors”, install a per-item plugin such as User Menus or Nav Menu Roles. For “a different menu on these pages”, use Conditional Menus. If your header is an Elementor template, place a menu widget per audience and give each a rule with the free Visibility Logic plugin.