从 WordPress 3.7 开始,WordPress就支持后台静默更新了,你可以根据 WordPress 3.7+ 配置后台自动更新 或 通过 Update Control 插件配置更新选项。默认情况下,WordPress自动更新后,会发送一封邮件到 后台 >设置>常规 中的 电子邮件地址,可能你并不想发送到这里设置的邮箱,也不想修改这里的设置,下面我们就来单独设置一个接收邮箱。
你可以将下面代码保存为一个 php 文件,然后上传到WP的插件目录,启用即可:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | <?php /* Plugin Name: Change WordPress auto update email address Plugin URI: http://www.iweb.co.uk/ Description: Change the email address auto update notifications are sent to following an automatic update. Version: 1.0 Author: iWeb Author URI: http://www.iweb.co.uk/ */ function iweb_filter_auto_update_email( $email ) { $email['to'] = 'username@example.com'; // 修改这里的邮箱地址 return $email; } add_filter( 'auto_core_update_email', 'iweb_filter_auto_update_email', 1 ); |
<?php /* Plugin Name: Change WordPress auto update email address Plugin URI: http://www.iweb.co.uk/ Description: Change the email address auto update notifications are sent to following an automatic update. Version: 1.0 Author: iWeb Author URI: http://www.iweb.co.uk/ */ function iweb_filter_auto_update_email( $email ) { $email['to'] = 'username@example.com'; // 修改这里的邮箱地址 return $email; } add_filter( 'auto_core_update_email', 'iweb_filter_auto_update_email', 1 );
或者可以尝试将代码(记得去掉代码第一行的 <?php 哦)添加到当前主题的 functions.php ,下同。(该操作未经测试,请热心朋友测试后反馈一下哦)
你还可以下载安装 Background Update Notification Email Address 插件,启用后在后台就可以设置接收邮箱。
如果你想禁止发送邮件通知,可以将下面代码保存为一个 php 文件,然后上传到WP的插件目录,启用即可:
1 2 3 4 5 6 7 8 9 10 | <?php /* Plugin Name: Disable all WordPress auto update email notifications Plugin URI: http://www.iweb.co.uk/ Description: Disable all WordPress auto update email notifications following an automatic update. Version: 1.0 Author: iWeb Author URI: http://www.iweb.co.uk/ */ add_filter( 'auto_core_update_send_email', '__return_false' ); |
<?php /* Plugin Name: Disable all WordPress auto update email notifications Plugin URI: http://www.iweb.co.uk/ Description: Disable all WordPress auto update email notifications following an automatic update. Version: 1.0 Author: iWeb Author URI: http://www.iweb.co.uk/ */ add_filter( 'auto_core_update_send_email', '__return_false' );
参考资料:http://www.iwebsolutions.co.uk/blog/change-wordpress-auto-update-email-address/
本文修改 WordPress 后台自动更新后接收通知的邮箱地址到此结束。一时的挫折往往能够经过不屈的搏击,变成学问及见识。小编再次感谢大家对我们的支持!