Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mitchellkrogza/ae7bacbefdc5a6080823f7043228bd25 to your computer and use it in GitHub Desktop.
Save mitchellkrogza/ae7bacbefdc5a6080823f7043228bd25 to your computer and use it in GitHub Desktop.
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