Delete un-used tags in WordPress

Open phpMyAdmin, make a backup of your database first

Find all un-used tags

SELECT * From wp_terms wt
INNER JOIN wp_term_taxonomy wtt ON wt.term_id=wtt.term_id WHERE wtt.taxonomy='post_tag' AND wtt.count=0;

Delete all un-used tags

DELETE wt, wtt From wp_terms wt
INNER JOIN wp_term_taxonomy wtt ON wt.term_id=wtt.term_id WHERE wtt.taxonomy='post_tag' AND wtt.count=0;

Use ”’wtt.count< =1”’ to delete only tags used only once, for example:

DELETE wt, wtt From wp_terms wt
INNER JOIN wp_term_taxonomy wtt ON wt.term_id=wtt.term_id WHERE wtt.taxonomy='post_tag' AND wtt.count<=1;