You should be able to set the login_url using the standard wordpress filter.
add_filter( 'login_url', 'my_login_page', 10, 2 );
function my_login_page( $login_url, $redirect ) {
return home_url( '/my-custom-login/' . $redirect );
}
Hi Jon,
thanks for the above answer but where do we put it? Location? Plugin editor or ?
Secondly i was it to redirect for registeration to my website registeration not wp admin registeration…. same goes for log redirects and logout redirects…
Can you help me with it. Thanks.
easiest way is to paste this code in your child theme’s functions.php file
but the theme function when gets updated its no longer there…. thus any other way?
Hello zawarhakeem,
You can use a child theme (highly recommended) and paste into the child theme functions file which will not get overwritten on theme updates. It is easy to create a child theme with:
Child Theme Configurator
https://wordpress.org/plugins/child-theme-configurator/
Or if you want to keep the functionality separated from your theme, so the function will remain even if you change themes, then you can use
Code Snippets
https://github.com/sheabunge/code-snippets
Best of luck 🙂
Hi There,
I’d like to redirect the Register menu item to a custom register page. Is there a way to do this?
I have tried putting the following function in my child functions.php file:
add_filter( ‘register_url’, ‘my_register_url’, 10, 2 );
function my_register_url( $register_url, $redirect ) {
return home_url( ‘/signon/’ . $redirect );
}
However it’s not redirecting and still navigating to ../wp-login.php?action=register
Thanks so much.
Hi ckennon,
Try this:
add_filter( 'register_url', 'my_register_url');
function my_register_url( $register_url ) {
return home_url( '/signon/' );
}
Although, I would suggest creating a page with name register instead of signon for registration purposes.