[wp-hackers] WP and spam

Mr. Awesome theone.andonly.mr.awesome at gmail.com
Tue Mar 18 06:06:58 GMT 2008


Viper007Bond wrote:
> Oh, sweet irony! :o

LoL! Since we're using that plugin for SK2... is there already code 
there for this, or could there be a way to just add this to the plugin 
file...

function akismet_delete_old() {
    global $wpdb;
    $now_gmt = current_time('mysql', 1);
    $wpdb->query("DELETE FROM $wpdb->comments WHERE DATE_SUB('$now_gmt', 
INTERVAL 15 DAY) > comment_date_gmt AND comment_approved = 'spam'");
    $n = mt_rand(1, 5000);
    if ( $n == 11 ) // lucky number
        $wpdb->query("OPTIMIZE TABLE $wpdb->comments");
}




More information about the wp-hackers mailing list