Home>Support>Switching menus

Switching menus

Hi,

I have a main menu and a header menu (from header widget). i would like different menus when a user of the site is logged in and logged out. I managed to acheive this only for the main menu using the following code:

function my_wp_nav_menu_args( $args = '' ) {

if( is_user_logged_in() ) {
$args['menu'] = 'logged-in';
} else {
$args['menu'] = 'logged-out';
}
return $args;
}
add_filter( 'wp_nav_menu_args', 'my_wp_nav_menu_args' );

Thanks any help will be appreciated!

This is our free support forum. Replies can take several days. If you need fast email support, please purchase a SiteOrigin Premium license.

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More