As the title states I'm trying to redirect users after they log in through the woocommerce login form to their respective custom pages (http://example.com/accounts/username)
So far I got this
add_filter('woocommerce_login_redirect', 'custo_login_redirect');
function custo_login_redirect( $redirect, $user ) {
$redirect = site_url( '/accounts/' . $user->user_login );
return $redirect;
}
but it is only redirecting to "http://example.com/accounts/" and not using the username in the url at all.
Is there a way to make it work? Thanks for any help.