powered by PeopleWithBlogs.com
Mass update comments status in WordPress

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!

Leave a Reply


Recent Network Posts


People are weird: I was trying to find out how many people prepare noodles without actually cooking them-by

Firefox spellchecker doesn't always catch errors in WordPress Visual editor: I've noticed a few times that Firefox's spellcheck doesn't always catch my spelling errors when

Thermostat still broken. Fingers frozen: My thermostat is still broken and my fingers are practically frozen. Everything else is wrapped

I really hate my neighbors: My loud, obnoxious neighbors really annoy me. I hope they fall down the stairs after

Yeah, Just Brakes, why do you do it?: And, don't say that you "really do care," because you don't. You only pretended to

Tatum O'Neal arrested on drug charges: Tatum O'Neal, who played Blythe on Wicked Wicked Games, was arrested on Sunday night after

 
 
Your Ad Here