Skip to content

Instantly share code, notes, and snippets.

@Soben
Created February 12, 2018 13:39
Show Gist options
  • Save Soben/d2c24e176be1df0eef649f9fb42671da to your computer and use it in GitHub Desktop.
Save Soben/d2c24e176be1df0eef649f9fb42671da to your computer and use it in GitHub Desktop.
UPDATE wp_term_taxonomy SET count = (
SELECT COUNT(*) FROM wp_term_relationships rel
LEFT JOIN wp_posts po ON (po.ID = rel.object_id)
WHERE
rel.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id
AND
wp_term_taxonomy.taxonomy NOT IN ('link_category')
AND
po.post_status IN ('publish', 'future')
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment