I found an answer myself, I’m leaving it here for someone who may face a similar problem in the future:
function my_custom_wpse_mail_from($original_email_address)
{
if (isset($_GET['action']) && $_GET['action'] == 'lostpassword') {
if (isset($_POST['user_login'])) {
return '[email protected]';
}
}
return $original_email_address;
}
add_filter('wp_mail_from', 'my_custom_wpse_mail_from', 10, 1);
function my_custom_wpse_mail_from_name( $original_from ) {
if (isset($_GET['action']) && $_GET['action'] == 'lostpassword') {
if (isset($_POST['user_login'])) {
return 'MyFromString';
}
}
return $original_from;
}
add_filter( 'wp_mail_from_name', 'my_custom_wpse_mail_from_name' );
Related Posts:
- Check for correct username on custom login form
- Forgot Password/ Password Reset Page does not exist
- WordPress password reset not working
- Cant login, Password MUST be reset error, after reset
- Add Confirm Password field in wp-login.php Password Reset page
- How to customise wp-login.php only for users who are setting a password for the first time?
- Give visitor access to password protected page/post via external script
- Send reset password link to user from custom lost password form
- How can I retrieve the username and password from my WordPress installation?
- password protect individual pages
- Problem with logging in WP users automatically
- How to determine if a user has not changed default generated password
- Right practice to edit WP reset password email
- Private page protected with username and password
- reset password link redirect to login page
- Password protect media attachment – share across guests
- Password reset – Disabled for LDAP accounts
- Why wp_update_user doesn’t update user_activation_key on users with apostrophes in their email?
- Correct passwords keep appearing as incorrect
- Forgot password needs to redirect from wp-login to a custom page
- Redirect login page except on reset pass
- How can I change the email sender name from wordpress to (myblogname) on the “lost password” email?
- How to password-protect everything except the logo
- Is there anyway to get the inputted password string from the login form?
- How can I password protect a WordPress site without requiring users to log in?
- Password not resetting on wordpress?
- autocomplete=”off” WordPress Login
- WordPress not logged in locally with correct username and password
- wordpress login without password just email address (NO 2 factor authentication with email)
- Can I protect a type of content site-wide with a single password?
- Password recovery URL has error – but not found in code or db
- Temporally disable password to login with empty password?
- I need to find which is the file that checks the DB for correct login (username, password)
- Login form does not store/remember/suggest users password
- How to invalidate `password reset key` after being used
- New user password confirmation sending wrong URL
- Locked out of WordPress admin area [closed]
- Global login to password protected pages
- Disable / Remove Password for Login WordPress
- How to password protect pages in WordPress
- Chosen user password in registration is not being accepted on Login
- User login without username, only password
- wp-login.php just refreshes the form fields
- Login just resets/reset password link also does not work
- wp_lostpassword_url not escaped
- Trouble logging in and/or changing password
- Cannot login with correct username and password anymore
- Log in a user upon password reset?
- Custom login form
- Make my wordpress blog remember my login “forever”
- How to check in timber if user is loggedin?
- Stop WordPress from logging me out (need to keep me logged in)
- Changing Login Logo
- Get user ID after logging in
- User Directory without a Plugin
- wp-admin seems to be redirecting
- Custom Connect to Facebook, problem logging in/logging out
- WordPress login urls
- How to customize reset_url or $reset_url
- WordPress Login page trashed
- Are there ways of logging in that bypass wp-login.php altogether?
- Change Favicon on Login Screen?
- How to display username and password after registration
- wp-login gives 404 error, but wp-admin is working fine
- Replace dash with space in username on login
- Autologin only working the second time
- Completely replacing the login form
- Changed primary domain and now wordpress login won’t work
- Keep user session with custom implementation of user login
- How to change “Reset Password” text on submit button
- Forcing frontend login with UI switch
- Login without Password
- what is the best and safest way to allow users to register to site
- Sharing a logged in session with a custom subdmain site?
- MAMP localhost wordpress site, not possible to sign in, username and password are correct
- Login issues wordpress page
- Make WordPress User Name be the Company Name when Registering (not the default ‘first name’ last name’ email address’)
- Why do I have a reauth=1 redirection loop when I try to log in to WordPress hosted on AWS Fargate?
- Confused – can’t access wordpress dashboard or site that has been published
- wordpress login loop and session problem
- unable to Login to Admin
- How to set password from frontend if have activation key and user login in url in wordpress?
- Fatal error: Call to undefined function get_plugin_data()
- Make WordPress User Name the Email Address When Register
- Users redirected to old site
- WordPress Login / SSL = Code Question
- Save user login date
- Login with Username (or Code) only
- wp_signon gives error insufficient_permissions
- Is there a way to give users the option to log in to their favorite group on login? [closed]
- Logging in takes a few refreshes to show you are logged in, is this a cache issue? [closed]
- Direct access to site when log in
- Can not login after moving to cloudflare and adding rules
- Inconsistent login state
- how to disable SSH login with password for some users?
- How to protect my credentials on my clients website
- Cant login to wp-admin or as author again
- Replace Header Element on WordPress Login Page
- Could not reset WordPress user password using WP CLI
- password reset link not being sent