Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Bypass logout confirmation in WooCommerce
function wc_bypass_logout_confirmation() {
global $wp;
if ( isset( $wp->query_vars['customer-logout'] ) ) {
wp_redirect( str_replace( '&', '&', wp_logout_url( wc_get_page_permalink( 'myaccount' ) ) ) );
exit;
}
}
add_action( 'template_redirect', 'wc_bypass_logout_confirmation' );
@lukecav

This comment has been minimized.

@knassik

This comment has been minimized.

Copy link

@knassik knassik commented Apr 17, 2018

This is the only solution that works, thank you very much!

@marlonassuncao

This comment has been minimized.

Copy link

@marlonassuncao marlonassuncao commented Aug 20, 2018

Thank you!

@Njengah

This comment has been minimized.

@phillipsar

This comment has been minimized.

Copy link

@phillipsar phillipsar commented Dec 2, 2019

I would like to add my thanks, too!

@lukecav

This comment has been minimized.

Copy link
Owner Author

@lukecav lukecav commented Dec 2, 2019

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment