Home › Forums › Support › Different main menu for logged in users This topic has 5 replies, 2 voices, and was last updated 3 years, 4 months ago by David. Viewing 6 posts - 1 through 6 (of 6 total) Author Posts November 27, 2020 at 11:08 pm #1554087 Michael Hello, I wish to use a different main menu for logged in users. adding this snippet works but it also changes my other navigation menus. add_filter( 'wp_nav_menu_args', function( $args ) { if ( is_user_logged_in() ) { $args['menu'] = 'Main2'; } else { $args['menu'] = 'Main'; } return $args; } ); I’m trying to avoid using a plugin thanks! November 28, 2020 at 7:37 am #1554999 DavidStaff Customer Support Hi there, you can set a condition for the Theme Location , for example this would apply to the Primary Nav: add_filter( 'wp_nav_menu_args', function ( $args ) { if ( 'primary' === $args['theme_location'] ) { if ( is_user_logged_in() ) { $args['menu'] = 'Main2'; } else { $args['menu'] = 'Main'; } } return $args; } ); November 28, 2020 at 5:16 pm #1555693 Michael That did the trick! thanks, David. I also plan to do the same for the Off Canvas Menu. Could you tell me how to target that as well? November 29, 2020 at 3:48 am #1556137 DavidStaff Customer Support The off canvas panel has a theme location of: slideout so this condition: if ( 'primary' === $args['theme_location'] ) { becomes: if ( 'slideout' === $args['theme_location'] ) { November 29, 2020 at 4:33 am #1556183 Michael That worked. thanks! November 29, 2020 at 5:37 am #1556271 DavidStaff Customer Support Glad to be of help Author Posts Viewing 6 posts - 1 through 6 (of 6 total) You must be logged in to reply to this topic. Log In Username: Password: Keep me signed in Log In