-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
Currently on multisites, if an user wants to request a new password from domains other than the main site, the url gets formatted weirdly leading to 404-error.
Can be fixed using the lostpassword_url
hook:
add_filter( 'lostpassword_url', __NAMESPACE__ . '\lost_password_url', 10, 2 );
An example of the function to pass (for development and production sites):
function lost_password_url( $lostpassword_url, $redirect ) {
// On main site no need to do anything
if ( get_main_site_id() === get_current_blog_id() ) {
return $lostpassword_url;
}
if ( 'development' === getenv( 'WP_ENV' ) ) {
$lostpassword_url = get_home_url() . '/wp-login.php?action=lostpassword';
return $lostpassword_url;
} else {
$lostpassword_url = get_home_url() . '/wp/wp-login.php?action=lostpassword';
return $lostpassword_url;
}
}
Metadata
Metadata
Assignees
Labels
No labels