I am having this same problem. I used the code in your FAQ but it’s not working.
I think maybe it’s something with the redirect function?
When you click on the forgot password link on my site it shows this in the URL bar:
https://team.evermark-lnl.com/login/?redirect_to=https%3A%2F%2Fteam.evermark-lnl.com%2Flostpassword%2F
BUT whitelisting /lostpassword/ does not work…
Hi– thanks for using Force Login!
I recommend you use the v_forcelogin_bypass
filter instead. For example:
/**
* Bypass Force Login to allow for exceptions.
*
* @param bool $bypass Whether to disable Force Login. Default false.
* @return bool
*/
function my_forcelogin_bypass( $bypass ) {
if ( is_page('passwort-vergessen') ) {
$bypass = true;
}
return $bypass;
}
add_filter( 'v_forcelogin_bypass', 'my_forcelogin_bypass' );
Additional References
https://developer.wordpress.org/reference/functions/is_page/
Hi Kevin
Thank you for your suggestion.
I have tested your code snippet with the «bypass»-filter. I’m afraid it didn’t work for me. The «whitelist»-filter atleast allowed me to get to the password-reset page. But with your new code i’m still getting redirected to the login page so it seems to fail.
Also how would this different Approach help with my initial problem? I need to Whitelist URLs where part of the URL is dynamic. Was your Code supposed to let all URLs containing «passwort-vergessen» through?
kind Regards
Christoph
OK i noticed the link to your github entrys in the FAQ about this and one of the examples there worked for me!
https://github.com/kevinvess/wp-force-login/wiki/Whitelist-Dynamic-URLs
sorry to bother you.
@bacherprepress
Great, I’m glad you got it working!
To answer your earlier question: the bypass example I sent should have allowed the page with a slug of 'passwort-vergessen'
to be publicly accessible (regardless of query string). Maybe I had the slug wrong? You could also pass the page ID instead. For example: is_page(1234)
.
Be sure to rate and review my plugin to let others know how you like it.
Thanks for using Force Login!