zchristian
Forum Replies Created
-
@hamiltonbrownfarringdon: you mean the “wp_redirect” filter code?
This has nothing to do with the plugin, but is an independent filter. Just add the code snipped to functions.php of the theme, or better create a child theme and a corresponding functions.php for the child.
Once activated, add_referrer() is called whenever a redirect happens within WordPress.@danieliser yes, I see the problem, that this will not work for most plugins providing custom login pages.
I use now the wp_redirect hook to add the redirect url
// add current url as parameter "redirect_to". Only if NOT logged in and current url != "wp-login.php" function add_referrer($url) { return (wp_validate_auth_cookie('','logged_in')!==false || strpos($_SERVER["REQUEST_URI"],"wp-login.php")!== false) ? $url : add_query_arg( 'redirect_to', urlencode($_SERVER["REQUEST_URI"]),$url); } add_filter( 'wp_redirect', 'add_referrer');
Christian
@hamiltonbrownfarringdon
Sorry for the late response!
The above solution just appends a parameter “dest” to the custom url. The value is the currently accesed page, which is protected.
On your custom login page you need to use the value of “dest” to redirect after successful login. E.g. fill the “redirect_to” value of the wp_login_form() call with this value.Hope that helps.
Christian