I'm looking for an efficient way to change the post status on many posts at once. I have a custom post type that I'm using as a means to store content that must be approved by a moderator before being published. I'm trying to give the moderator the ability to "approve all" or "reject all" on a fairly large number of posts (100-200 would be common).
The best solution I've come up with is to make an ajax call that sends a list of post id's to the server, which loops through them calling the below function:
wp_update_post(array('ID'=> $post_id, 'post_status' => 'publish' ))
This results in a query to the DB for each post, however, and it's much slower than I'd like. Ideally, I'd be able to make a query that changes the post status to 'publish' on all of the post ID's in the list at once, but I can't find any means to do this.