Z
Z
zeaovede2022-04-02 20:17:06
WordPress
zeaovede, 2022-04-02 20:17:06

How to redirect to my account?

Moved the woocommerce authorization form to a separate page. Now, on a click to enter, authorization occurs, but there is no redirection to my account. How can I redirect to my account from a separate page?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Artem Zolin, 2022-04-04
@zeaovede

The redirect rule after authorization can be set on the hooklogin_redirect

add_filter( 'login_redirect', 'login_redirect', 10, 3 );
function login_redirect( $redirect_to, $request, $user ) {

  if ( is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
    return get_edit_user_link( $user->ID );
  }

  return $redirect_to;
}

WooCommerce also has its own hook woocommerce_login_redirect, you can try to use it
add_filter( 'woocommerce_login_redirect', 'filter_function_name_7289', 10, 2 );
function filter_function_name_7289( $remove_query_arg, $user ){
  // filter...

  return $remove_query_arg;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question