【发布时间】:2018-03-26 13:08:42
【问题描述】:
当用户在 WordPress 网站上注册帐户时,是否可以修改发送给用户的激活电子邮件的内容?
我希望更改电子邮件的主题和正文,以便阅读更符合我网站信息的内容。
我尝试将以下内容添加到 mu-plugins 中的自定义插件中,但似乎完全没有影响:
<?php
/*
Plugin Name: Disable Username and Password Notification
Description: Disables the Username and Password email
*/
// Start changing email body
function myprefix_change_activation_email_body ($old_body, $domain, $path, $title, $user, $user_email, $key, $meta) {
$my_message = "Hi! This is my new email! ";
$my_message .= "Your site {$title} is almost ready. We probably also want to include the activation key: {$key} ";
$my_message .= "Activate your site here : http://{$domain}{$path}wp-activate.php?key=$key";
// ... 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 = "Hi! You just registered on my site!";
return $my_subject;
}
add_filter('wpmu_signup_blog_notification_subject', 'myprefix_change_activation_email_subject', 10, 8);
// End changing email subject
据我所知,问题在于所使用的过滤器最有可能用于我的站点不是的多站点设置。它只是一个标准的 WordPress 网站。
干杯
【问题讨论】:
-
我所指的激活邮件实际上是来自一个插件,并不是 WordPress 的默认功能,所以我的问题是无关紧要的!