Different Menu for Logged-in and Logged-out

Posted in: Newspaper
Post count: 7

Good day Team,

On the HEADER MENU LOCATION, I want add 2 different menus (of which I have created already and name as logged-in and logged-out); one for the Logged-in and another for Logged-out users.

I’ve implemented the code below on the newspaper’s function.php:

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' );

and it seems not to work. Is it the a way of accomplishing this?

Thanks.

Post count: 6600

Replied here

Thanks for the message!

Viewing 2 posts - 1 through 2 (of 2 total)
The forum ‘Newspaper’ is closed to new topics and replies.