Skip to content

Instantly share code, notes, and snippets.

@francois-blanchard
Created December 22, 2016 10:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save francois-blanchard/25a6fbba6b017075cac336e9f8651d68 to your computer and use it in GitHub Desktop.
Save francois-blanchard/25a6fbba6b017075cac336e9f8651d68 to your computer and use it in GitHub Desktop.
Manage tags with SQL wordpress

Manage tags with SQL wordpress

List tags

SELECT name, slug, description, COUNT FROM wpbandc_terms
NATURAL JOIN wpbandc_term_taxonomy
WHERE taxonomy="post_tag"
ORDER BY name;

Delete tags

DELETE t, tr, tt
FROM wp_terms t  
INNER JOIN wp_term_taxonomy tt ON t.term_id = tt.term_id
INNER JOIN wp_term_relationships tr ON tt.term_taxonomy_id = tr.term_taxonomy_id
WHERE tt.taxonomy = 'post_tag'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment