Redirect doesn’t work (‘my_forcelogin_redirect’)
-
Hello,
I have setup a
my_forcelogin_redirect
in myfunctions.php
file but when users try to access the site, they’re still redirected to/wp-login.php?redirect_to=http%3A%2F%2Fproject-name.dev%2Fhttp%3A%2F%2Fproject-name.dev%2Flogin%2F
I am wanting my users to be redirected to
/login/
.Below is my code:
/** * Restrict access without login **/ // Redirect login page function my_forcelogin_redirect() { return site_url( '/login/' ); } add_filter('v_forcelogin_redirect', 'my_forcelogin_redirect', 10, 1); // Whitelist specified URLs/pages function my_forcelogin_whitelist( $whitelist ) { $whitelist[] = site_url( '/login/' ); $whitelist[] = site_url( '/reset-password/' ); return $whitelist; } add_filter('v_forcelogin_whitelist', 'my_forcelogin_whitelist', 10, 1);
Viewing 9 replies - 1 through 9 (of 9 total)
Viewing 9 replies - 1 through 9 (of 9 total)
- The topic ‘Redirect doesn’t work (‘my_forcelogin_redirect’)’ is closed to new replies.