Home | Articles | Wordpress | Remove Unused Post Tags From the WordPress Database

Remove Unused Post Tags From the WordPress Database

If you have been using WordPress for a while, you may notice that you have some Post Tags that could have gone unused or removed from posts as you edit them. Instead of looking through each post tag to determine which are assigned and which arent, just run this Query to remove the unused post tags and then enjoy a nice hot cup of Joe!

[SQL]DELETE FROM wp_terms WHERE term_id IN (SELECT term_id FROM wp_term_taxonomy WHERE count = 0 );
DELETE FROM wp_term_taxonomy WHERE term_id not IN (SELECT term_id FROM wp_terms);
DELETE FROM wp_term_relationships WHERE term_taxonomy_id not IN (SELECT term_taxonomy_id FROM wp_term_taxonomy);[/sql]

About Joe D

I have always had a passion for everything computing. In early 2000, I decided to take my passion to the web. Thus, C.O.D. was born. Through the years we have made many great friends at C.O.D. and hope to continue our journey for years to come.

Check Also

Manage Multiple WordPress Sites with InfiniteWP

Running your website, or websites, on WordPress is an easy choice as the flexibility the …

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.