SQL query to delete comments older than 90 days?

Regarding comments- what about the case where a comment older than 90 days has child replies younger than 90 days?

for comment and pingback status, this should do it:

UPDATE wp_posts SET comment_status="closed", ping_status="closed" WHERE post_date < DATE_SUB(NOW(), INTERVAL 3 MONTH) AND post_status="publish";

Leave a Comment