[wp-hackers] Update Category Count after Bulk Delete

Brian Layman wp-hackers at thecodecave.com
Wed Mar 30 14:03:14 UTC 2011

On 3/30/2011 5:32 AM, Jason wrote:
> 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...?
> Cheers
> JC.
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
update `wp_term_taxonomy` set  `count`=(select count(*) from 
wp_term_relationships where 

and if you messed with comments:


Brian Layman

More information about the wp-hackers mailing list