[ad_1]
Hi there,
I’ve added a snippet to create a logout menu without confirmation.
add_filter( ‘wp_nav_menu_items’, ‘add_loginout_link’, 10, 2 );
function add_loginout_link( $items, $args ) {
if (is_user_logged_in() && $args->theme_location == ‘primary’) {
$items .= ‘Logout’;
}
return $items;
}
It works perfectly on the primary menu greatly, but it doesn’t appear in the off canvas menu.
Could you please let me know How I can modify the code to fix this?
Thank you in advance for your help!
