WordPress – db_term_taxonomy reset count

Reset the term count:

UPDATE wp_term_taxonomy tt SET count = (SELECT count(p.ID) FROM  wp_term_relationships tr LEFT JOIN wp_posts p ON (p.ID = tr.object_id AND p.post_type = 'post' AND p.post_status = 'publish') WHERE tr.term_taxonomy_id = tt.term_taxonomy_id) WHERE tt.taxonomy = 'tag';Code language: JavaScript (javascript)