你可以change them using a filter. 要使用的筛选器挂钩包括:
对于first email 消息(确认他们确实要重置密码):
\'retrieve_password_title\'
\'retrieve_password_message\'
对于follow-up email 消息(发送新用户名和密码):
\'password_reset_title\'
\'password_reset_message\'
Update: 要创建和使用这些过滤器,请在
functions.php
文件:
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.\') . "\\r\\n\\r\\n";
$message .= network_site_url() . "\\r\\n\\r\\n";
$message .= sprintf(__(\'Username: %s\'), $user_login) . "\\r\\n\\r\\n";
$message .= __(\'To reset your password visit the following address, otherwise just ignore this email and nothing will happen.\') . "\\r\\n\\r\\n";
$message .= network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user_login), \'login\') . "\\r\\n";
// 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 );
如果还想修改
follow-up email. 使用
WordPress code 作为创建主题行和消息的指南(查找变量
$title
和
$message
).