WordPress 默认情况不会审核评论到底是不是管理员发表的,如果有人知道博主的昵称和邮箱就可以冒充管理员发表评论,可能会给博客以及个人信誉造成糟糕的影响,荒岛本次带来 WordPress 评论留言防冒充管理员的教程,只要将下面的代码添加到主题的「functions.php」文件即可。
// 荒岛一座藏有宝藏的小岛 function usercheck($incoming_comment) { if ( is_user_logged_in() ) return $incoming_comment; $isSpam = 0; if (trim($incoming_comment['comment_author']) == ''.get_option('admin_name').'') $isSpam = 1; if (trim($incoming_comment['comment_author_email']) == ''.get_option('admin_email').'') $isSpam = 1; if(!$isSpam) return $incoming_comment; err('请勿冒充荒岛管理员'); }宝藏内容来自荒岛-https://x-imagine.com/wordpress-comment-on-anti-impersonation-admin-tutorial.html宝藏内容来自荒岛-https://x-imagine.com/wordpress-comment-on-anti-impersonation-admin-tutorial.html
请按「Ctrl+D」收藏荒岛分享给好友,如您发现本文教程或宝藏链接已失效,请联系站长修正!
荒岛公众号
扫一扫关注

HDsoft27
公众号ID已复制,前往微信关注...
荒岛哔哩姬
扫一扫关注

ximagine
哔哩姬ID已复制,前往B站关注...