How to Mass Delete Unused Tags in WordPress
Bloggers often come across the word spam and we have already covered a list of plugins to prevent spam comments. But what about registered users who create awful number of tags and never return back or use it in their posts ?
Sometimes even we create tags which remain unused in our blog posts. Do we have the time daily/weekly to check for such tags and delete them one by one ?
I’ll take up my own example here. A year and some months ago I had opened up DailyBlogging for guest posting just to realize an year later that it was a big mistake. Not the guest posting part but the user registration one. Yes, I had blindly ticked the ‘Anyone can register’ option in the WordPress Settings page.
No Captcha, email verification, nothing. After few months I checked the contributors list and found that there were 500+ users. The number of posts submitted for review by these spam users were above 1000 in number.
The first step was to turn off user registrations. After that I decided to do a mass clean up and manually started deleting the posts and users. But at that time it didn’t strike me that there would be so many unused post tags.
Remove Unused tags with ‘Mass Delete Unused Tags’ Plugin
The next step was to remove those unused tags and ‘Mass Delete Unused Tags’ plugin did that in minutes. Check the detailed tutorial below.
- Take a full database backup (either use the WP DB Backup plugin or from the host panel itself).
- Download and Install Mass Delete Unused Tags plugin from your WordPress dashboard.
- Select the ‘Yes, delete all unused terms’ option and hit the Delete Terms button.
- Don’t refresh your browser tab or window till all the unused post tags are deleted. Mass Delete Unused Tags plugin deletes 50 tags at a time to avoid database crashes.
Delete Unused WordPress Tags [SQL Query]
Below is a small but powerful SQL query (from Sumtips) which will delete all the unused tags from your WordPress database.
DELETE FROM wp_terms WHERE term_id IN (SELECT term_id FROM wp_term_taxonomy WHERE count = 0 ); DELETE FROM wp_term_relationships WHERE term_taxonomy_id not IN (SELECT term_taxonomy_id FROM wp_term_taxonomy);
Remember I haven’t tried the SQL method, so use it with caution and after taking a complete database backup of your WordPress blog. Hope this tutorial helped you in removing plenty of unused WordPress tags created by spammers.
Have you faced such a problem before on your blog ? If yes, did you try any other plugin or manually deleted those tags ??