修改 WordPress 後臺自動更新後接收通知的郵箱地址

從 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/

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *