Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1008451

    I spent a lot of time working on a solution for this, and I finally found it so I wanted to share it.

    To show different menus to users and non-users, paste this filter into your functions.php file.

    /*
    * Filter to show different menus to users and non-users
    */
    
    add_filter( 'wp_nav_menu_args', 'my_wp_nav_menu_args' );
    
    function my_wp_nav_menu_args( $args = '' ) {
    
    if($args['theme_location'] === 'avia') 
         if( is_user_logged_in() ) { 
              $args['menu'] = 'THE NAME OF YOUR LOGGED IN MENU HERE'; 
              } else { 
              $args['menu'] = 'THE NAME OF YOUR LOGGED OUT MENU HERE';
              } 
    return $args;
    }

    Hope this is able to help someone looking for a solution that isn’t a plugin.

    • This topic was modified 6 years, 7 months ago by jaketa.
    #1008454

    Hey Jaketa,

    Thanks for sharing! :)

    Regards,
    Yigit

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.