4

I need to change the default email text that will be sent to recover the password. I have already changed the mail of activation in multisite:

// Start changing email body
function myprefix_change_activation_email_body ($old_body, $domain, $path, $title, $user, $user_email, $key, $meta) {
    $my_message .= "\n\nhello {$user} ,welcome to {$domain} !\n\n";

    // ... other stuff
    return $my_message;
}
add_filter('wpmu_signup_blog_notification_email', 'myprefix_change_activation_email_body', 10, 8);
// End changing email body

// Start changing email subject
function myprefix_change_activation_email_subject ($old_subject, $domain, $path, $title, $user, $user_email, $key, $meta) {
    $my_subject = "my subject";
    return $my_subject;
}
add_filter('wpmu_signup_blog_notification_subject', 'myprefix_change_activation_email_subject', 10, 8);
9

You want the filters...

retrieve_password_message for the actual email content. Your hooked function will get the message as the first argument and the user's reset key as the second.

<?php
add_filter('retrieve_password_message', 'wpse103299_reset_msg', 10, 2);
function wpse103299_reset_msg($message, $reset_key)
{
    // ...
}

retrieve_password_title for the the email subject.

<?php
add_filter('retrieve_password_title', 'wpse103299_reset_subject');
function wpse103299_reset_subject($subject)
{
    // ...
}

Take a look at the retrieve_password function which you can find in wp-login.php.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.