Guten Abend, ich habe etwas im Internet gefunden und ich habe versucht dies nach vollzuziehen und auch zu machen, aber immer noch ohne die richtige L?sung zu haben.
I had been wrestling with doing this some and finally got it working after a few approaches. Redirecting on login only seems to be as simple as adding this to form-login.php
<input type=”hidden” name=”redirect” value=”/set-redirect-url”>
to the login form inputs. On the registration form inputs, this doesn’t work at all. Which is odd but I guess it’s just ignored, haven’t bothered digging through the code that handles the registration yet.
Now, with the above filter, my solution involved doing something like this in form-login.php on the registration form inputs. I check for something and then add this input if its true. I only want to redirect to a particular page if the user is doing something unique to my site
<input type=”hidden” name=”my_redirect_var” value=”/set-redirect-url”>
Then just add this in functions.php
add_filter ( ‘woocommerce_registration_redirect’, ‘my_registration_redirect’);
function my_registration_redirect( $redirect ) {
if ( $_POST[‘my_redirect_var’] ) {
$redirect = $_POST[‘my_redirect_var’];
}
return $redirect;
}
If my check in form-login.php is true, it adds the hidden input, which is found in my filter and the $redirect is changed.
Ich habe quasi der form-login.php % function.php
<input type=”hidden” name=”my_redirect_var” value=”/set-redirect-url”>
——————–
add_filter ( ‘woocommerce_registration_redirect’, ‘my_registration_redirect’);
function my_registration_redirect( $redirect ) {
if ( $_POST[‘my_redirect_var’] ) {
$redirect = $_POST[‘my_redirect_var’];
}
return $redirect;
}
umge?ndert, aber trotzdem wird es weiter auf myaccount umgeleitet.
Hat niemand ein Tipp oder L?sungsvorschlag dazu.
Mit bestem Gru?
Darius