2007
04.01

Apart of Captcha!, to fight trackback SPAM I also use Trackback Validator, which works very well but has a little problem however: regardless the trackback is ham or spam, you always get it via email if “mail comments” feature is enabled in your WP panel. So you might end up with your mailbox flooded of spam trackbacks (even though they’re correctly filtered in your blog).

Due to this, I’ve made a little hack to fix this. So only valid trackbacks are mailed to you, not the SPAM ones.

Update: (2007-04-01) It seems I’m not the first one to do something like this. Although it uses another approach (hacking WP directly).

1. Thanks for the suggestion, but when I make that change, I get email again.

Like or Dislike: 0  0

2. Jon, to me it’s updating (at least with valid trackback / pingbacks).

Try changing the line which reads:
wp_set_comment_status($comment_ID, 'delete'); And put: wp_set_comment_status($comment_ID, 'spam');

Like or Dislike: 0  0

3. I like this hack, but is there a way to eliminate the email while still allowing the “trackback_graph” to be updated?

Like or Dislike: 0  0

4. Alex, here you are:
[code lang="php"]
10a11
>
135c136,139
< ---
>
> if ($tb_info['comment_type'] != 'trackback') // Ensure it's a trackback > return$comment_ID;
>
141c145,146
< $wpdb->query("UPDATE$wpdb->comments SET comment_approved = '1' WHERE comment_ID = '$comment_ID'"); --- > //$wpdb->query("UPDATE $wpdb->comments SET comment_approved = '1' WHERE comment_ID = '$comment_ID'");
> wp_set_comment_status($comment_ID, 'approve'); 143c148,150 <$wpdb->query("UPDATE $wpdb->comments SET comment_approved = 'spam' WHERE comment_ID = '$comment_ID'");
---
> //$wpdb->query("UPDATE$wpdb->comments SET comment_approved = 'spam' WHERE comment_ID = '$comment_ID'"); > // wp_set_comment_status($comment_ID, 'spam');
> wp_set_comment_status($comment_ID, 'delete'); 145c152 < update_comment_count($tb_info['comment_post_ID']);
---
> //update_comment_count(\$tb_info['comment_post_ID']);
147c154
< ---
>
297c304