[1.2] Delete spam-comments instead of just queuing them!
-
I do not know where to post hacks, so I post it here in the support forum.
I am under constant “attack” from spammers trying to post a lot of comments in my wordpress-blogs. The clostest thing to getting rid of these was entering words into the setup to get them into the moderation queue instead of being posted directly.
First I created a mysql cron-job to delete all comments with the field comment_approved in table wp_comments equal to 0. This deleted all the unwanted posts, but I still got >25 emails a day telling me that a comment expected approval.
So I opened the file wp-comments-post.php and browsed through it and found the test that sent the notification email to the blog owner.
I changed the following:
if (!$approved) {
wp_notify_moderator($comment_ID);
}to:
if (!$approved) {
$wpdb->query(“DELETE FROM $tablecomments WHERE comment_ID =$comment_ID”);
}And I got rid of the cron-job, notification mail and most importantly the unwanted comments. ??
- The topic ‘[1.2] Delete spam-comments instead of just queuing them!’ is closed to new replies.