add_action('init','wpsites_members_menu');
function wpsites_members_menu(){
if(is_user_logged_in()){
add_filter( 'wp_nav_menu_args' , 'logged_in_nav_menu' );
}
}
Display Different Nav Menu For Logged in and Logged Out Users
Source: http://wpsites.net/web-design/members-nav-menu-logged-in-members/
function logged_in_nav_menu( $args ) {
if ( $args['theme_location'] == 'primary' ) {
$args['menu'] = 'members';
}
return $args;
}
Related Posts:
- Add custom classes to anchor in wp_nav_menu
- How do I add support to my theme for custom menus?
- Any official way to create an admin theme?
- Creating Multiple Menus when using the TwentyTen Theme?
- Two Navigation Menus in Themes Produce the same menus?
- Displaying wp menus by name without using theme locations
- Setting a Default ‘Theme Location’ When Creating a Menu
- Two Navigation Menus – secondary nav is including main nav
- How to remove background image from post navigation elements?
- My Admin bar covers my sticky navbar [closed]
- How to find out if page_for_posts is showing (in order to style menu item)
- how to remove category nav from Bueno (WordPress Theme) header [closed]
- Most wp_nav_menu parameters ignored
- Default Nav Highlight
- How to remove the tripadvisor logo from the wordpress theme?
- Make a menu item unselectable
- How can I fetch the next level of the currently selected main menu (hierarchical menu)?
- Custom theme – pages in menu
- WordPress site hamburger menu toggle not working
- WordPress Menu Navigation links not working
- Target Internal Link Of Another Page On Website
- Theme Options Menu Item – Permission Issue
- Lightword Theme – only one menu item
- How to make navigation a list without a plugin? [duplicate]
- How to add or remove borders in navigation menu?
- Prevent primary navigational menu from expanding during page load (WordPress / Astra Theme)
- How do I remove the hamburger menu from the Twenty Twenty Four theme?
- How to change background color in the Notepad++ text editor?
- How to change or add theme to Android Studio?
- WordPress frameworks and parent themes [closed]
- Programmatically add a Navigation menu and menu items
- Opinions and recommendations on the best barebones base theme [closed]
- Remove JSON API links in header html
- Using OOP in themes
- Where can I download WordPress themes from? [closed]
- How can I allow the Editor Role to change Theme Settings?
- Adding an Arbitrary Link to the Admin Menu?
- Dynamically exclude menu items from wp_nav_menu
- What are all the available parameters for query_posts?
- Customizing a WordPress theme without changing it?
- Where can I learn to create my own theme?
- How do I turn off self-closing tags for markup in WordPress (for HTML5, or HTML4, for example)?
- how to add version of style.css in wordpress
- Does WordPress work without a theme?
- wp_nav_menu(), how to change class?
- What is the role and history of the $content_width global variable?
- Adding admin-ajax.php to the frontend. Good or bad idea?
- Split up wp_nav_menu with custom walker
- How to move the sidebar in TwentyFifteen to the right?
- How to Link External jQuery/Javascript files with WordPress
- Installation failed: Download failed. No working transports found
- What is theme-compat?
- Is there an easy way to replace a custom menu link with a page or post?
- Override parent theme translation on child theme
- WordPress Theme activation hook?
- Can wordpress theme folder name be changed freely and nothing technically happens
- Link to specific Customizer section
- What does exactly GPL license mean for my WordPress theme?
- Am I allowed to license my WordPress theme under the aGPL
- How do I change the header image height in Twenty Seventeen?
- Starter Theme vs Parent Theme? Pros and cons
- How to change the language for the front-end only?
- W3 Total Cache, CDN and theme files [closed]
- Best way to include Bootstrap in WordPress
- Mega Menu Walker
- How to set thumbnail image for a (child) theme
- How to Add to Each Menu Link with link text to data-attr?
- Different template of products for specific category. WooCommerce
- Show different theme for admin?
- Add Javascript to WordPress Menu
- Filter wp_nav_menu()
- How can I version the main CSS file?
- How to modify navigation menu of the “My Account” page in WooCommerce
- what the best way to include images from the template’s images folder?
- Is it OK to remove theme credits from footer? [duplicate]
- Undefined offset: 0 in > […] /wp-includes/capabilities.php on line 1067
- Custom ID for certain menu item?
- How can I get the title attribute from get_the_post_thumbnail()?
- Dash or underscore in theme folder name?
- No “Add New” Button. How to add new theme?
- “Unexpected error” on update requests
- How to prevent plugin, theme installation failures on WordPress?
- How do I white label my self-hosted site created by wordpress?
- Do Child-Themes automatically load the Translation from the Parent-Theme?
- When cropping a header image, retain meta data (i.e. name, description, etc.) from original image?
- Best practices for a Style/CSS based theme options page?
- Add data-icon input to WordPress custom menu links
- Displaying Logged-In User Name in WordPress Menu
- Remove current_page_parent nav class from blog index when in CPT
- How to create a new theme from scratch?
- Categorising themes by folders in backend
- Switching themes without losing widgets?
- How to use media upload on theme option page?
- Remove Container Element From wp_nav_menu() Markup
- Dynamic template serving, change theme_root using add_filter from current theme
- What theme is good for posting code? [closed]
- WordPress 5 / Gutenberg – theme doesn’t have featured image option showing up
- Custom Taxonomy-specific JavaScript
- Add Dividers or Separators Between Nav Menu Items
- How to refresh WordPress Customizer panel upon entering a value