Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallTo add conditional logic to WordPress navigation, first decide whether you need to swap an entire menu for a page or archive context, or show and hide individual links. A menu-location plugin is suited to the first job; a per-item visibility plugin or a WordPress menu hook is suited to the second. In every case, confirm that your theme renders the expected menu location: hiding a link does not restrict access to the linked page.
Choose the kind of conditional behavior you need
| What should change? | Approach | What to check |
|---|---|---|
| Replace the whole menu for certain posts, pages, categories, or archives | A menu-location plugin such as Conditional Menus | Its listing describes swapping menus at theme locations and says compatibility is based on the standard WordPress menu function. |
| Show a particular link only to signed-in or signed-out visitors | A per-item visibility plugin such as IF Menu Visibility | Its listing describes visibility choices for all, logged-in, and logged-out visitors. Check that its visibility field appears in your menu editor. |
| Apply a site-specific condition or control which items are rendered | A WordPress menu hook | Choose a hook according to whether you need to filter item objects or the final list-item HTML. |
Check the theme location and assigned menu first
WordPress displays the menu assigned to the theme location passed to wp_nav_menu(). The function also has fallback behavior: if the requested location or menu is unavailable, it can use a fallback callback. That means a conditional change may appear not to work if the theme renders a different location, the location has no expected menu assigned, or a fallback produces the visible navigation instead. See the WordPress wp_nav_menu() reference.
- In the WordPress admin, open Appearance > Menus and identify the menu assigned to the relevant theme location.
- Confirm that the front end actually renders that location and menu. Theme implementations differ; do not assume every theme or block navigation setup uses the same rendering path.
- When testing conditional behavior, compare the page or visitor states that should produce different navigation.
Use a plugin when its condition matches
Switch menus by page or archive context
Conditional Menus describes assigning different menus to theme locations based on posts, pages, categories, and archive pages. Its listing places the controls under Appearance > Menus, on Manage Locations. It says the approach works with themes that use the standard WordPress menu function, so confirm that your theme follows that path before relying on it.
Show or hide individual items by login state
IF Menu Visibility describes per-item choices for showing an item to all visitors, logged-in visitors, or logged-out visitors, managed in Appearance > Menus. Its listing notes that a theme or plugin overriding the navigation-menu admin walker may prevent the visibility field from appearing. If the control is missing, check for that kind of admin customization rather than assuming the front-end condition is broken.
Recommended Free Tools
#1 Best Overall
Menu Visibility Control is another directory listing for per-item visibility, but its brief description does not establish which conditions it supports or how its capabilities compare. Check its current listing and controls against your specific requirement before choosing it.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Use a code hook for custom conditions
WordPress exposes menu hooks at different stages. Use an object-level hook when the condition should remove or alter menu items before HTML is generated; use wp_nav_menu_items when you need to change the rendered list-item HTML. The latter receives the list content and a stdClass object containing the wp_nav_menu() arguments. Its reference says the hook was introduced in WordPress 3.0.0. See the hook reference.
Filter rendered list-item HTML for one menu location
This example appends a link only when the rendered menu’s theme_location is primary and the visitor is logged in. Replace the location slug and destination with values from your site.
add_filter( 'wp_nav_menu_items', 'site_add_member_menu_item', 10, 2 );
function site_add_member_menu_item( $items, $args ) {
if ( empty( $args->theme_location ) || 'primary' !== $args->theme_location ) {
return $items;
}
if ( is_user_logged_in() ) {
$items .= '<li class="menu-item menu-item-members"><a href="/members/">Members</a></li>';
}
return $items;
}
The location check prevents the change from affecting every menu rendered by the site. This hook filters HTML, not menu-item objects; use an object-level hook if you need to remove or modify actual items before rendering.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Clear out junk files and repair common Windows errors3Fix the driver behind crashes, sound loss and screen glitchesRank #3
Filter menu items before HTML generation
wp_get_nav_menu_items filters retrieved menu item post objects and receives the menu object and retrieval arguments. The wp_nav_menu() reference also documents wp_nav_menu_objects, which receives sorted item objects before HTML generation. These are starting points when your logic needs to change which items are included rather than append or alter final markup. Consult the wp_get_nav_menu_items reference and the wp_nav_menu() reference for their respective arguments and return values.
Quick Recap
Best Value
Rank #4
Verify the result and protect restricted content separately
- Confirm the theme location and assigned menu in Appearance > Menus.
- Apply the plugin condition or code hook that matches the desired scope: whole menu, individual item, or custom filtering.
- Check the front end in each relevant context, such as the pages or archives that should switch menus and logged-in versus logged-out sessions for visibility rules.
- If a plugin field is missing, check whether an admin walker override is in use. If the intended menu does not change, verify that the theme uses the standard menu-rendering path and that the expected location is active.
- Enforce permissions on the destination itself wherever content is private. Navigation visibility is presentation behavior, not authorization.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

