给出的答案都是善意的。但都不好。过滤器函数调用有更多参数,确切地说是4个。
这对我的邮件有效(我想用用户电子邮件替换用户名)
注意,我们有一个多站点页面。您可能希望将network\\u site\\u url替换为get_site_url()
通常在您的functions.php
您的文字按时间:
add_filter("retrieve_password_message", "mapp_custom_password_reset", 99, 4);
function mapp_custom_password_reset($message, $key, $user_login, $user_data ) {
$message = "Someone has requested a password reset for the following account:
" . sprintf(__(\'%s\'), $user_data->user_email) . "
If this was a mistake, just ignore this email and nothing will happen.
To reset your password, visit the following address:
" . \'<\' . network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user_login), \'login\') . ">\\r\\n" . "
If you have any further issues, please email us to [email protected]
The Myapp Team";
return $message;
}
奖励:更改电子邮件标题/主题
add_filter( \'retrieve_password_title\',
function( $title )
{
$title = __( \'Password reset for myapp.org\' );
return $title;
}
);