I have created a small function for a WC customer to be able to logout without giving access to wp-login.php.
Is this enough in terms of security (ie. does it completely destroys the user session)? Are there any extra steps, or even unnecessary ones?
I have found so many solutions each one suggesting something else.
function my_wc_logout_function() {
if ( stristr($_SERVER['REQUEST_URI'], 'custom-logout') ) {
wp_destroy_current_session();
wp_clear_auth_cookie();
do_action( 'wp_logout' );
}
}
1