Make two menu, one with login link and the other with logout link
Add the following code to functions.php
function my_wp_nav_menu_args( $args = ” ) {
if( is_user_logged_in() ) {
$args[‘menu’] = ‘with-logout-button’;
} else {
$args[‘menu’] = ‘with-login-button’;
}
return $args;
}
add_filter( ‘wp_nav_menu_args’, ‘my_wp_nav_menu_args’ );