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.
