Logout Menu Not Showing on Canvas-Off Menu

[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!

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer