When the password reset goes out, the name is ‘WordPress’ and the from address is wordpress@domain.com. I need to change these to the company name.
I’m running WordPress 3.8 multisite and have done the following:
- Updated general settings name and email address for the subsite
- Installed ‘WP Change Email’ plugin and updated the details
However, this has no effect. I think its because the password reset side of things uses different hooks.
I’m using the following code (from http://s14.codeinspot.com/q/2472332) in functions.php to customise the password reset title and body:
function my_retrieve_password_subject_filter($old_subject) {
// $old_subject is the default subject line created by WordPress.
// (You don't have to use it.)
$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
$subject = sprintf( __('[%s] Password Reset'), $blogname );
// This is how WordPress creates the subject line. It looks like this:
// [Doug's blog] Password Reset
// You can change this to fit your own needs.
// You have to return your new subject line:
return $subject;
}
function my_retrieve_password_message_filter($old_message, $key) {
// $old_message is the default message already created by WordPress.
// (You don't have to use it.)
// $key is the password-like token that allows the user to get
// a new password
$message = __('Someone has asked to reset the password for the following site and username.') . "rnrn";
$message .= network_site_url() . "rnrn";
$message .= sprintf(__('Username: %s'), $user_login) . "rnrn";
$message .= __('To reset your password visit the following address, otherwise just ignore this email and nothing will happen.') . "rnrn";
$message .= network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user_login), 'login') . "rn";
// This is how WordPress creates the message.
// You can change this to meet your own needs.
// You have to return your new message:
return $message;
}
// To get these filters up and running:
add_filter ( 'retrieve_password_title', 'my_retrieve_password_subject_filter', 10, 1 );
add_filter ( 'retrieve_password_message', 'my_retrieve_password_message_filter', 10, 2 );
However, I don’t know how to extend this to change the from name and email address?
You can use the following two hooks to change name and email address
Use the following in your active theme’s
functions.php
file.Use the following code in your active theme’s
functions.php
file. No need to hard code your email address and blog name, this gets both as given in WordPress Settings > General.