Bypass “Are you sure you want to log out?” message in WooCommerce

Share Now

Share on facebook
Share on pinterest
Share on twitter
Share on linkedin
Share on email
add_action( 'template_redirect', 'logout_confirmation' );

function logout_confirmation() {
    global $wp;
    if ( isset( $wp->query_vars['customer-logout'] ) ) {
        wp_redirect( str_replace( '&', '&', wp_logout_url( wc_get_page_permalink( 'myaccount' ) ) ) );
        exit;
    }
}
Nahid Mahamud

Nahid Mahamud

Web Developer | Graphic Designer | WordPress & Woo-commerce Expert