Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
WP: Redirect to home page for WooCommerce login logout and registration
/*----------------------------------------------------------------------------*/
// redirects for login / logout / registration
/*----------------------------------------------------------------------------*/
// Redirect after login
add_filter('woocommerce_login_redirect', 'login_redirect');
function login_redirect($redirect_to) {
return home_url();
}
// Redirect after logout
add_action('wp_logout','logout_redirect');
function logout_redirect(){
wp_redirect( home_url() );
exit;
}
// Redirect after registration
add_filter( 'registration_redirect', 'my_redirect_home' );
function my_redirect_home( $registration_redirect ) {
return home_url();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment