2020年2月

评论提醒管理员需要用到server酱这个平台

具体使用看页面就很了解了

开通并使用上它,只需要一分钟:

登入:用GitHub账号登入网站,就能获得一个SCKEY(在「发送消息」页面)
绑定:点击「微信推送」,扫码关注同时即可完成绑定
发消息:往 http://sc.ftqq.com/SCKEY.send 发GET请求,就可以在微信里收到消息啦

下面就是wordpress里面的设置了,找到主题的function.php,,打开functions.php最后一行是“?>”,把下面的内容加入这一行的上面。记得替换你的 SCKEY。

//评论微信推送
function sc_send($comment_id)
{
$text = '博客上有一条新的评论';
$comment = get_comment($comment_id);
$desp = $comment->comment_content;
$key = '你的SCKEY';
$postdata = http_build_query(
array(
'text' => $text,
'desp' => $desp
)
);

$opts = array('http' =>
array(
'method' => 'POST',
'header' => 'Content-type: application/x-www-form-urlencoded',
'content' => $postdata
)
);
$context = stream_context_create($opts);
return $result = file_get_contents('http://sc.ftqq.com/'.$key.'.send', false, $context);
}
add_action('comment_post', 'sc_send', 19, 2);

 

如图,
即可,