I used iThemes Security (formerly Better WP Security) hide back-end functionality to change the login url to /signin however clicking the lost password link /wp-login.php?action=lostpassword now generate a 404
Manually going to /signin?action=lostpassword works.
I came across the following code below which is suppose to make the change to however after some testing it doesn’t seem to work
//*******************************************************
//Function to change to lost password url
//********************************************************
add_filter('site_url', 'wplogin_filter', 10, 3);
function wplogin_filter( $url, $path, $orig_scheme ){
$old = array( "/(wp-login.php)/");
$new = array( "signin/"); //this can be change to login or whatever or may remain there
return preg_replace( $old, $new, $url, 1);
}
add to .htaccess
RewriteRule ^signin$ wp-login.php
How can i modify the above code in order to change the url for the lost password?
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
the solution is simple, there is a filter to change the lost password url.
Try this :
add_filter( 'lostpassword_url', 'wdm_lostpassword_url', 10, 0 );
function wdm_lostpassword_url() {
return site_url('/signin?action=lostpassword');
}
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0