This morning I awoke to being absolutely blitzkreiged with trackback spam. So with a couple of quick SQL queries, I was all happy with the world again. BUT, that isn’t the end of it, unfortunately because you know how these bastards are: they just keep coming back.
Have no fear, you probably already have what you need!
If you’re using the Auto Shutoff Comments plugin (and if you aren’t, why the hell aren’t you? No one wants to legitimately talk about old shit!), it’s relatively easy.
By default the plugin only stops comments from being posted after a certain date, but allows old posts to still be trackbacked. In order to fix that, just add the following line to the .php file:
$wpdb->query ("UPDATE $tableposts SET ping_status = 'closed' WHERE post_date < '$cutoff_date' AND post_status = 'publish'");>
right under the line where the Update command says SET comment_status=’closed’. The final lines in the update section of the script will now look like this:
$wpdb->query ("UPDATE $tableposts SET comment_status = 'closed' WHERE post_date < '$cutoff_date' AND post_status = 'publish'");>>
$wpdb->query ("UPDATE $tableposts SET ping_status = 'closed' WHERE post_date < '$cutoff_date' AND post_status = 'publish'");
I know. You love me.
Seriously, this will close the ping ability on all posts older than a number of days you specify in the script.
Simple.
Effective.
And the nice thing about this is that it runs everytime you write a post or someone writes a comment, or any other database is within your WordPress install is updated. As Ron Popeil says on his infomercials, just "set it and forget it!"