Skip to content

Instantly share code, notes, and snippets.

@mauricerenck
Last active January 23, 2017 11:14
Show Gist options
  • Save mauricerenck/a81a628007bc0ef08df6372f272af210 to your computer and use it in GitHub Desktop.
Save mauricerenck/a81a628007bc0ef08df6372f272af210 to your computer and use it in GitHub Desktop.
WooCommerce: edirects for login / logout
/*----------------------------------------------------------------------------*/
// edirects for login / logout
/*----------------------------------------------------------------------------*/
add_filter('woocommerce_login_redirect', 'login_redirect');
function login_redirect($redirect_to) {
$location = $_SERVER['HTTP_REFERER'];
wp_safe_redirect($location);
exit();
}
add_action('wp_logout','logout_redirect');
function logout_redirect(){
$location = $_SERVER['HTTP_REFERER'];
wp_safe_redirect($location);
exit();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment