I’m working on a site that has 150,000 comments with an obvious hit in performance; is there an SQL query that can delete all comments older than say 90 days? They’re not spam comments, and they are all approved; they’re just too numerous.
And: what about bulk changing all posts older than 90 days to untick “Allow comments” and “Allow trackbacks and pingbacks”? So they don’t get re-commented?
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';