How To Delete Pingbacks, Spam Comments and Unused Tags in WordPress

WordPress is a great CMS, but it can get cluttered over time, and there’s no better way to remove all the unnecessary junk than to go clean it up in MySQL. Here are 3 quick SQL queries you can run to clean up your MySQL database.

SQL command to delete all spam comments in WordPress:

DELETE from wp_comments WHERE comment_approved = ’0′;

SQL command to delete all pingbacks in WordPress:

DELETE FROM wp_comments WHERE comment_type = ‘pingback’;

SQL command to delete all unused tags in WordPress:

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

, , , ,

About Site Fixit!

Sam is a professional web designer and web developer. He has over 15 years of experience with web-related technologies, and loves making things work.

View all posts by Site Fixit!

No comments yet.

Leave a Reply