Yes, it is possible.
You could use wp_nav_menu_objects
or wp_nav_menu_items
hooks to add your filter function.
function my_hide_menu_items($objects) {
if ( is_admin() ) return $objects;
foreach ( $objects as $k=>$object ) {
if ( YOUR CONDITION ) { // if $object shouldn't be displayed
unset($objects[$k]);
}
}
return $objects;
}
add_filter('wp_nav_menu_objects', 'my_hide_menu_items', 10, 2);
You can also use this plugin: http://wordpress.org/plugins/menu-items-visibility-control/ (I haven’t tested it, so I’m not sure if it really works).
Related Posts:
- How to add wechat (weixin) link to navigation menu?
- Add a data attribute to list item element in menu
- Add custom menu item using wp_nav_menu_items filter
- Does Extending Multiple Nav_Menu_Walkers Allow Nested Menus?
- Add separator to admin submenu
- On which hook should I be calling register_nav_menu(s)?
- Removing link ” from ” menu for some “links” without JS
- Using filters to change href of nav menu page link
- Menu is not visible in appearance
- One site, 2 distinct sections: two different top nav menus?
- Links open only on new tab or window
- Make Theme automatically choose default nav menu
- How can I disable parent menu item links?
- How to get current page menu item name instead of full menu item list
- Organizing by super-categories (or nested categories)?
- Nav menu items disappearing (but not immediately)
- wp_nav_menu custom walker – child items
- wp_nav_menu doesn’t generate parent/ancestor classes
- Pending Custom Link in Menu
- Change HTML structure for custom menu in sidebar
- Force PDF download from custom menu?
- Page-Linking Structure
- Custom Admin Menu Order
- Current menu item
- remove everything from wp_nav_menu
- Best way to customise wp_nav_menu [duplicate]
- Image as a link using wp_nav_menu()
- Link that refers to a menu item with dynamically generated URL
- Fragment URL in navigation item without a custom link
- Link to Homepage in Menu
- How to add custom classes to more than one separate menu’s a link in wordpress?
- How do I separate link levels in a custom menu walker?
- SlideDeck 2, make back-end visible for admins only
- Separator for custom nav menu
- How do you link to a place in another page without any styling issues?
- Custom Links menu items include in Search Results
- Menu custom link not working for external site
- Why is wordpress forcing https link generation?
- pull non-wp site into content area of wordpress -or- pull wp header into non wp site?
- Help with walker for nav
- Create custom page and add it in nav menu by code
- Using my WordPress menu on another platform
- Links do not open from click, only in new tab [closed]
- Adding existing links to custom navigation menus?
- Remove a menu sub-item
- Using _s theme, menu changes do not affect header menu
- Make pages visible to only logged in members
- Get custom classes in WordPress Navigation Menu
- Replace the slug of parent pages with # [closed]
- How to change the link on the logo at the menu?
- Creating Menu Links in a Custom Theme
- The cart, checkout, and shop links not getting removed
- How do I create a root link in wordpress to a PDF file?
- Position a hard-coded menu item
- How to undo the last changes to a custom menu?
- URL links consistent with menus?
- Filter to hook into menu items and add a custom attribute
- I can’t add more pages to menu – menu delete pages
- Responsive menu on genesis theme [closed]
- Opening Menu link in another tab
- Active class to current link
- How to add class to anchor using wp_nav_menu
- Simple form to add custom links to menu?
- How to open a lightbox form from a navigation menu item
- How to create this kind of sub-menu in new line?
- Main menu navigation links and new pages
- custom menu widget where menu title is a link
- 2 item in a same menu pointing to 1 page
- Hide custom menu when when no menu selected
- How to show pages in menu without link
- Problem with links once in portfolio item
- How to create a link-less parent (top level) menu item that doesn’t use an anchor tag
- Menu links URL with PHP GET method
- remove or hide Link Relationship (XFN) form Menus tab
- Classes CSS (Optional) – how do I reference this in php?
- Why does WordPress convert absolute URLs to relative URLs for menu items?
- Parent link need to go first child submenu
- Adding images to anchors in the list created and fetched with wp_nav_menu
- Links in new menu don’t work
- How to make menu output links absolute
- how to display wordpress navbar with top menu outside wordpress system
- change link of menu particular tab
- Menu Structure with Links failure to update
- Top menu link anchor href value change after online server?
- custom rearranged menu with excerpt for selected children in sidebar.php
- Show content of subdomain from specific menu-item?
- wp_nav_menu in 3.7 add name class nav navbar-nav
- How do I add a link to the menu that has a charector (?) in it?
- Menu – custom structure
- Remove link from Page name in navigation bar
- Change menu item order
- Menu System: Custom Links
- Unsual behaviour of navigation Menus
- How to centre menu items on horizontal nav bar? (e.g. make margins equal) [closed]
- Wrapping my ‘s with
- Displaying list of random links using wp_nav_menu
- WordPress removes URL parameters from menu elements when saving the menu
- how to add permalink/slug to wordpress custom link menu item
- After WordPress 4.8 upgrade, wp_nav_menu() string search / replace not working
- Main Menu Hover is Always White