一直有一些很無聊的人在某些部落格上特別喜歡冒充博主來評論,所以今天就來教大家如何防止在WordPress評論中被人冒充博主
教學
在下方選擇適合自己部落格的評論方式,然後把代碼添加到「佈景函式庫(functions.php)」的最底部 ?> 之前,然後點擊「更新檔案」就行啦!(如果不清楚自己的評論模式,可以兩種都試試,或者在下方評論來問我)
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | /* 防止在WordPress評論中被人冒充博主開始(由AREFLY.COM製作) */ function no_fake_blog_owner_comment($incoming_comment){ 	$name = array('博主名稱'); 	$email = array('博主郵箱'); 	global $user_ID; 	if(!is_super_admin()){ 		if(in_array(strtolower(trim($incoming_comment['comment_author'])), $name) || in_array(strtolower(trim($incoming_comment['comment_author_email'])), $email)){ 			wp_die('請不要冒充博主發表評論!'); 			exit; 		}else{ 			return $incoming_comment; 		} 	}else{ 		return $incoming_comment; 	} } add_filter('preprocess_comment', 'no_fake_blog_owner_comment'); /* 防止在WordPress評論中被人冒充博主結束(由AREFLY.COM製作) */ | 
預覽
本站所有文章的評論框中輸入博主的信息(我一定不會告訴你我的郵箱是 eflyjason@gmail.com 的)  
 
历史上的今天
2013年:2013年3月30日(8条评论)
