I am trying to conditionally switch an entire nav menu (not nav items) when a user is logged in, but the below code changes all menus.
The menu I am switching does not have a theme location to target it's added via wp_nav_menu().
add_filter( 'wp_nav_menu_args', 'foobar' );
function foobar( $args ) {
if ( is_user_logged_in() && $args['menu'] == 'Non-Members Area' ) {
$args['menu'] = 'Members Area';
return $args;
}
}
How do I target the menu Non-Members Area?