Hi @jurasjo,
I found a workaround, but I can’t get it to work with the WooCommerce endpoint. At least the users won’t have to confirm the logout.
If you create a custom link in your menu, set the label to “Logout”, and set the URL to https://yourdomain.com/wp-login.php?action=logout. Then add this function to your functions.php file:
function change_menu($items){
foreach($items as $item){
if( $item->title == "Logout"){
$item->url = $item->url . "&_wpnonce=" . wp_create_nonce( 'log-out' );
}
}
return $items;
}
add_filter('wp_nav_menu_objects', 'change_menu');
I am still trying to figure out how to redirect users after logout, because I don’t want them to see the default WP login page after they logout. Also, I’d still like the WooCommerce endpoint to include the wpnonce.