[wp-hackers] Update Category Count after Bulk Delete

Jason jason at findingsimple.com
Wed Mar 30 09:32:30 UTC 2011

Hey Guys,

I need to bulk delete about 4k posts from a site - all the posts are
assigned to a specific category.

Does anyone have any MYSQL snippets or pointers to something that will do
the job? I don't think WP Bulk Editing or any of the bulk delete plugins
will do the trick for such a large number of posts.

So far I can bulk delete the posts using something like:

*DELETE a,b,c,d FROM wp_term_relationships a
JOIN wp_term_taxonomy b ON b.term_taxonomy_id = a.term_taxonomy_id
JOIN wp_terms c ON c.term_id = b.term_id
JOIN wp_posts d ON d.id = a.object_id
WHERE c.name = 'Test Delete';*  --Category Name

But that still leaves the remaining category counts incorrect and comments
still in the system.

Thoughts? Help...?


More information about the wp-hackers mailing list