Change the login page

7.46K viewsCorelogin
1

Hi,

When an unlogged user try to post a question I don’t want Anspress to direct him to the default WP login page, but rather to my usurper login page.  How do I do that?

 

Thank you guys

0

We are simply using :

wp_login_url( $redirect );

Hence, you can simply use this hook to filter your login url:

add_filter( 'login_url', 'my_login_page', 10, 2 );
function my_login_page( $login_url, $redirect ) {
    return home_url( '/my-login-page/?redirect_to=' . $redirect );
}

Cheers.

Thank you Rahul! I add the above code in my theme function.php?

and what is the code for the register URL?

Rahul, also, the code you provided above direct me to the following URL: http://www.mysite.com/my-login-page/?redirect_to=http://www.mysite.com/anspress_title/ which doesn’t work

Replace “my-login-page” to your userpro login page