I found a solution that helped me.
My solution is changing in wp-login.php, yes i know I should not do that, so I was hoping someone could tell me what to do instead.
My solution:
change this in wp-login.php line 406
case 'logout' :
check_admin_referer('logout');
wp_logout();
$redirect_to = !empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : 'wp-login.php?loggedout=true';
wp_safe_redirect( $redirect_to );
exit();
break;
change
check_admin_referer(‘logout’);
to
check_admin_referer(‘log-out’);
Reason:
Woocommerce creates the nonce when page loads.
calls function wp_logout_url($redirect = ”) which creates the logout url.
in wp-includes/general-template.php
which creates the logout_url with among other:
$logout_url = wp_nonce_url( $logout_url, 'log-out' );
there is the ‘log-out’, and not as expected ‘logout’.
someone who knows more than me should figure it out.
kind regards
carl erik