本篇文章更新時間:2019/02/16
如有資訊過時或語誤之處,歡迎使用 Contact 功能通知。
一介資男的 LINE 社群開站囉!歡迎入群聊聊~
如果本站內容對你有幫助,歡迎使用 BFX Pay 加密貨幣新台幣 贊助支持。


網站管理員一直收到信而其他人沒收到留言通知的情況也不太適合多人管理情境。

這個時候就是如果能自訂收件人與信件樣式就能比較有彈性!

外掛的改法可以參考這款:Custom Comment Notifications

外掛強歸強,但也要有變數替換概念的操作,才會比較能理解怎麼去設計、修改。

而如果只是要指定某些人收信,可以從 functions.php 去客製化,方法為:

function mxp_comment_moderation_recipients($emails, $comment_id) {
    // 以此類推新增收件人
    $emails = array('[email protected]', '[email protected]', '[email protected]');
    return $emails;
}
add_filter('comment_moderation_recipients', 'mxp_comment_moderation_recipients', 11, 2);
add_filter('comment_notification_recipients', 'mxp_comment_moderation_recipients', 11, 2);

Gist: link

這程式碼片段中的陣列就是有留言時,網站通知的收件人陣列,改成你想通知的對象信箱即可!


Share:

作者: Chun

資訊愛好人士。主張「人人都該為了偷懶而進步」。期許自己成為斜槓到變進度條 100% 的年輕人。[///////////____36%_________]

參與討論

  1. service

1 則留言

發佈留言

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


文章
Filter
Apply Filters
Mastodon