Redirect registration and logic page

5.24K viewsUpdates
1

Hi Rahul,

How do I avoid anspress to follow wp-login.php login page. I have created my own login and registration page. How do I redirect anspress to it

deleted answer

I have a similar issue here. Could hard code it, but would rather do it with a function or hook.

1

@Anup – here you are – please these two functions in your functions.php (child theme)

add_filter( ‘login_url’, ‘change_login_page’, 10, 3 );
function change_login_page( $login_url, $redirect, $force_reauth ) {
return home_url( ‘/login’ . $redirect );
}

add_filter( ‘register_url’, ‘change_register_page’, 10, 3 );
function change_register_page( $login_url, $redirect, $force_reauth ) {
return home_url( ‘/register’ . $redirect );
}

Obviously, change “/login” and “/register” to match the actual URL you want to use

0

Hello,

AnsPress is using inbuilt WP functions for getting login and registration link. You must use proper hooks for adding your custom login page.

Check this functions:

wp_registration_url

wp_login_url

commented on answer

Thanks Rahul – perfect.

Hello Rahul, I am using Anspress in a subsite of WordPress Multisite, and only allow user register account in a subsite, like register.oursite.com, in this situation, how should I do please? Should I add the above code into function file of our child theme? Or should I use the function of wp_registraion_url? thnaks. Alex