How to Disable Comments On Older Posts to Cut Down on Spam

If you’re getting a fair bit of spam on older blog posts, you may want to disable commenting on posts older than a year or two. Because your posts are still indexed by search engines, you’ll still be getting traffic there, but you may not want the burden of answering questions on posts that are obsolete.

You can easily do this in less than a minute with this SQL query. Sign in to phpmyadmin for your WordPress database and run this query:

{code type=html}
UPDATE wp_posts SET comment_status = ‘closed’ WHERE post_date < '2009-01-01' AND post_status = 'publish';

You can change the date to whatever suits your site’s needs.

Source: Perishable Press