I have the following SQL query that allows me to retrieve and delete all messages of a custom message type older than X days.
SELECT * FROM `wp_posts`
WHERE `post_type` = ‘clothing’
AND DATEDIFF(NOW(), `post_date`) > 2
DELETE * FROM `wp_posts`
WHERE `post_type` = ‘clothing’
AND DATEDIFF(NOW(), `post_date`) > 2
However, from what I read on the Internet, it seems that the code above does not really delete the message metadata, so I still have a bunch of data left over.
My question is, how can I change this code so that all related meta information is also removed from deleted messages?
thank
source
share