If you have the need to mass update the status of your comments on your WordPress blog, this snippet of code is very handy. WordPress MU users, don't fret, because this works for MU, too.
It is just a snippet, so MU users will have to adjust it and put it into their own script so that their actual blog owners can access the code. MU users may want to just put the snippet in a simple PHP script that will execute the code once the link to the script is clicked. The only "hard" thing about this is getting the Blog ID from the admin panel, which is where the link to the script should be placed. I have not attempted to do this from the admin panel, but I'm sure that the Blog ID is not hard to find. I will update this post later once I actually look for the Blog ID in the MU dashboard.
UPDATE wp_BLOGID_posts SET comment_status = 'closed' WHERE post_date < '2009-01-11' AND post_status = 'publish';
Regular WordPress users can execute this code straight from phpMyAdmin or wherever they have the ability to update their databases.
UPDATE wp_posts SET comment_status = 'closed' WHERE post_date < '2009-01-11' AND post_status = 'publish';
WordPress and WordPress MU users should note that the only difference between the two snippets of code is the name of the posts table. MU users must specify the post table by including the Blog ID as indicated in the code.
Posted February 11, 2009 Digg It!