Skip to content

Instantly share code, notes, and snippets.

Last active November 16, 2021 10:11
  • Star 10 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
WP: Redirect to home page for WooCommerce login and logout. #ST3
// redirects for login / logout
add_filter('woocommerce_login_redirect', 'login_redirect');
function login_redirect($redirect_to) {
return home_url();
function logout_redirect(){
wp_redirect( home_url() );
Copy link

Worked in almost 2022.

But for security reasons, you must use wp_safe_redirect instead.

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