Forked from gbot/woocommerce-login-logout-redirects.php
Last active
September 30, 2021 11:02
-
-
Save mitchellkrogza/ae7bacbefdc5a6080823f7043228bd25 to your computer and use it in GitHub Desktop.
WP: Redirect to home page for WooCommerce login logout and registration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*----------------------------------------------------------------------------*/ | |
// 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