我需要更改将发送的默认电子邮件文本以恢复密码。我已经在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);
SO网友:chrisguitarguy
您需要筛选器。。。
retrieve_password_message
对于实际电子邮件内容。挂钩函数将获得消息作为第一个参数,用户的重置键作为第二个参数。
<?php
add_filter(\'retrieve_password_message\', \'wpse103299_reset_msg\', 10, 2);
function wpse103299_reset_msg($message, $reset_key)
{
// ...
}
retrieve_password_title
对于电子邮件主题。
<?php
add_filter(\'retrieve_password_title\', \'wpse103299_reset_subject\');
function wpse103299_reset_subject($subject)
{
// ...
}
看看
retrieve_password
可以在中找到的函数
wp-login.php
.