The question I asked here needs to be modified as I have a different problem. I asked the following question on the WordPress support forum but it seems that nobody has an answer to that. I wonder why? Here it is: I am trying to customize the password retrieval message by applying a filter as follows:
function retrieve_password_message_filter($message, $key, $user_login, $user_data) {
$message = __('Someone has asked to reset the password for the following username on this site:') . "\r\n\r\n";
$message .= site_url( '/secrets/') . "\r\n\r\n";
$message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";
$message .= __('If this was a mistake, just ignore this email and nothing will happen.') . "\r\n\r\n";
$message .= __('To reset your password, visit the following address:') . "\r\n\r\n";
$message .= '<' . network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user_login), 'login') . ">\r\n";
return $message;
}
add_filter ( 'retrieve_password_message', 'retrieve_password_message_filter');
This works up to a point but the link for the password reset is invalid - WordPress is applying only parts of the filter ignoring the username and password reset link. Obviously something else needs to be added to the code above but my searches everywhere seem to show that the code I am using is supposed to work. Does this mean that I have to copy the whole section from wp-login.php relevant to the password retrieval in order just to change the wording of the message? Would you be able to help?