Skip to content

Instantly share code, notes, and snippets.

@judge
Created November 11, 2013 15:22
Show Gist options
  • Save judge/7414829 to your computer and use it in GitHub Desktop.
Save judge/7414829 to your computer and use it in GitHub Desktop.
recount wordpress taxonomies
UPDATE wp_term_taxonomy tt1
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' OR p.post_type = 'interview' ) AND p.post_status = 'publish')
WHERE tr.term_taxonomy_id = tt1.term_taxonomy_id)
WHERE tt1.taxonomy = 'post_tag'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment