Skip to content

Instantly share code, notes, and snippets.

@mikejolley
Created March 2, 2012 15:25
Show Gist options
  • Save mikejolley/1959165 to your computer and use it in GitHub Desktop.
Save mikejolley/1959165 to your computer and use it in GitHub Desktop.
WooCommerce - Change login redirect
/*
* goes in theme functions.php or a custom plugin
*
* By default login goes to my account
**/
add_filter('woocommerce_login_widget_redirect', 'custom_login_redirect');
function custom_login_redirect( $redirect_to ) {
$redirect_to = 'http://anypage.com';
}
@whitneyr
Copy link

Hmm. Not able to get this to work.
Are you referring to the theme's functions.php because this doesn't work.
I am want to redirect users who login to the home page and not the account page.

@claudiosanches
Copy link

It would be better:

/**
 * goes in theme functions.php or a custom plugin
 *
 * By default login goes to my account
 */
add_filter('woocommerce_login_widget_redirect', 'custom_login_redirect');

function custom_login_redirect( $redirect_to ) {
    return 'http://anypage.com';
}

@jennybeaumont
Copy link

How about redirecting to last visited page?

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