You can do that by using 2 different menus (wp_nav_menu).
use is_user_logged_in conditional tag and apply a different menu accordingly:
if (is_user_logged_in()) {
wp_nav_menu(array('theme_location' => 'logged_user' ));
} else {
wp_nav_menu(array('theme_location' => 'new_user' ));
}
Edit
This code goes where you’d usually put your regular menu in the theme – probably header.php
Also, make sure that you add the menus to the actual theme, i.e. in function.php add the folowing lines of code:
if (function_exists('register_nav_menu')):
register_nav_menu('logged_user', 'Existing users menu');
register_nav_menu('new_user', 'New users menu');
endif;
Related Posts:
- Walker class: Problems with understanding how walk() method can be called without error
- How to Use the Function is_user_logged_in To Display Different Menus?
- Remove all nav menu classes ( but keep useful ones… )
- Trouble creating conditional PHP for nav menu items with children for custom Walker
- create a select input with menus created on a custom options page
- Add data-id attribute to child page links
- Adding an Anchor Link to a wordpress menu using WPBakery Page Builder
- Featured image in menu wordpres
- How to get the count for each taxonomy term
- Mega Menu Walker
- Displaying Logged-In User Name in WordPress Menu
- Get author full name
- Integrating WordPress to my website, while keeping my own authentication system
- Remove/unset options field from backend Settings->General?
- How to preserve PHP modifications while upgrading WordPress?
- How can I hook into and edit the text of a wp_nav_menu tag?
- Removing jQuery migrate and working with dependencies
- How to show only parents subpages of current page item in vertical menu?
- removing tags from wp_list_pages() using PHP
- Authenticating to WordPress, using my own authentication two-factor system
- Replacing the NavWalker dropdown element
- How to add specific menu on a specific page or pages
- there’s a way to include a minimal WP for check only the current user, its roles (caps?) and then release/free it?
- Widgets not showing in my custom theme
- Second Navigation inside header
- How to display something in a div when the user clicks on a text in another div – no page refresh [closed]
- How to get 2 or multiple custom post types in wordpress functions.php
- How to display conditional-content if wp_nav_menu( $args ) retruns something
- Can’t extend some core classes
- Show comments menu in dashboard only if the site has comment
- Setting custom canonical urls
- Count top level menu items
- Only show search results with if current date is between two dates?
- database interactions using OOP
- Menu — How to add “current-menu-grand-ancestor” css class
- Hide Hamburger Menu On Specific Page (Front Page/Home Page)
- WordPress blog post url on category page
- Extending the WP_Widget_Text class
- Menu Limitations
- Retrieve $_POST data submitted from external URL in WordPress(NOT API)
- Trying to build simple deposit code that hooks into woocommerce
- Custom Walker_Nav_Menu issue with variables on PHP 7.3
- user_profile_update_errors hook not executing
- Saving and Restoring a Canvas on A Individual User Basis
- Extend plugin Class through functions.php
- How to add a do_action on refreshing of WP customizer?
- Weird 404 URL Problem – domain name being placed at end of urls
- Output custom field value to post string
- Compare the old get_theme_mod($name) to the new get_theme_mod($name) return value
- Need help enqueueing webfonts
- Custom Menus: dynamic highlighting problem with custom home link
- Redirect to another page using contact form 7? [closed]
- Custom Background by Page IDs
- Add item to top of menu using a filter in functions.php
- Underscore – Self hosted fonts
- How to style one item from main navigation?
- Hook called before text widget save
- Automatically add images to a menu
- Menu Custom Data Attributes
- How to modify mobile nav menu text in theme
- Nav menu from plugin to theme
- Custom navigation menu with awsAccordion
- List of Events with Multiple Dates: Only NEXT Date
- Set cookie for visitor
- Why in this WordPress theme I can’t see the Main Menu?
- wp nav menu: show submenu below li item
- Display movies that apear this day next
- Dynamic Menu drops pages?
- Styling an “active” link outside of WordPress default menu
- Array data not saving to specified sections. How to make seting independantly?
- Integrate otp in my custom singup form
- Hide A Class and Add Custom HTML Code Using WordPress
- How do I know if the user is a customer?
- How to block specific user id in custom login form?
- I want to fusion the product columns in email table order
- How to set Nav as a default menu in wordpress
- Adding new divs with custom classes to products on WooCommerce shop page [closed]
- Get Child of Child Pages in custom Menu
- How to disable sub menu items from being created?
- Bring Font Awesome icons inside menu A tags
- Add custom attribute to product’s HTML to woocommerce cart page
- Automatically refresh page if widget is added to page?
- Display specific main Sub Nav on Woocommerce product pages
- PHP drop down menu for my get_category child of
- Show content by using tags
- Editing existing pre-created menus in PHP
- Active class not working on custom menu link using add_menu_page
- Use custom get results query to show posts WordPress
- How can I show only if custom field has content [closed]
- media-uploader insert into post is not inserting
- How to show all of aspecific post type that has taxonomy and a specific term
- How to hide something from custom home page with php code?
- How To Customize Position of »add to cart« of WooCommerce on Product Page [closed]
- Display a list of users with avatar filterable with alphabets
- Custom Links in Walker Class
- WordPress menu links with images & class selection
- Open WordPress Page from selected option dropdown
- How to remove the intro animation which appears during the load up of some WordPress themes? [closed]
- Remove Unused Menu Locations
- Custom Navigation Bar JSON Syntax Error in JSON at Position 0