// Change login link for Woocommerce product review's "Login" link
add_filter( 'login_url', 'my_login_page', 10, 2 );
function my_login_page( $login_url, $redirect ) {
return home_url( '/my-account/?redirect_to=' . $redirect );
}
add_filter('woocommerce_login_redirect', 'rohil_login_redirect');
function rohil_login_redirect( $redirected_to ) {
$page_url = $_SERVER['REQUEST_URI']; //To get string from the URL
$current_page_url = get_permalink(); //To get URL of the current page which is MY ACCOUNT
$encoded_url = explode('redirect_to%3D', $page_url); //To get encoded URL
$decoded_url = rawurldecode($encoded_url[1]); //To get decoded URL
$redirection_page = explode(home_url(), $decoded_url); //Redirection page
$redirected_to = home_url().$redirection_page[1];
return $redirected_to;
}
// Change login link for Woocommerce product review's "Login" link