Thread Starter
fud
(@fud)
I think this may be an Auth0 problem actually. I currently have the Auth0 plugin installed, which takes over the WordPress login..
I suspect this isn’t working because you’re using a query string ?page_id= as the custom login URL. Are you not able to configure a mod_rewrite to use a “pretty permalink?”
https://codex.ww.wp.xz.cn/Using_Permalinks
And since Force Login is using the builtin WordPress function wp_login_url( $redirect ) to get the login URL to redirect to – while also passing a $redirect URL for after a successful login – it might be having trouble appending a second query string to the login URL for the after login $redirect URL.
Have you tried using the get_permalink() function instead of the site_url() function to specify your custom login URL?
//Custom Login URL
function my_login_page( $login_url, $redirect ) {
return get_permalink( 2487 );
}
add_filter( 'login_url', 'my_login_page', 10, 2 );
Otherwise, I suggest using mod_rewrite and your .htaccess file to create a custom login URL that works without the ?page_id= query string.
Thread Starter
fud
(@fud)
Hmm, so we tried to use get_permalink, and actually for both ways, if I try to just access mydomain.com/wp-login.php it will redirect me to my custom url.
The problem is that if I try accessing a blocked page directly, Force Login seems to break so I’m not directed to a login page. I think the problem with using mod_rewrite and .htaccess is that I’m using mydomain.com/wp-login.php?wle to login to my admin dashboard since I have the Auth0 plugin installed.
The problem is that if I try accessing a blocked page directly, Force Login seems to break so I’m not directed to a login page.
Can you be more specific about what is happening? Are you getting a PHP error – if so, what does it say? What exactly is happening when it “breaks?”
If you disable the Auth0 plugin, does everything work as expected? If so, then yes – the issue is caused by a conflict with that plugin.
Thread Starter
fud
(@fud)
Sorry, when I said breaks, I meant that I was able to access the page without having to login.
Thread Starter
fud
(@fud)
Nevermind, I just configured some Auth0 stuff, so I got it working.
Thanks!