Last Updated: August 01, 2017
·
230
· tonyxrandall

SQL queries for wordpress comments

Delete unapproved comments:
DELETE FROM wpcomments WHERE commentapproved = 0

Disable comments on old posts:
UPDATE wpposts SET commentstatus = 'closed' WHERE postdate < '2016-03-11' AND poststatus = 'publish';

Delete pingbacks
DELETE FROM wpcomments WHERE commenttype = 'pingback';

Delete comments from specific URL
DELETE from wpcomments WHERE commentauthorurl LIKE "%nastyspamurl%" AND wpcomments.comment_approved = 'spam';

https://makeawebsitehub.com/sql-query-hacks-wordpress/