Created
March 15, 2023 15:50
-
-
Save benjibee/521df7456baad6e93ef16bee9f1c81a8 to your computer and use it in GitHub Desktop.
WordPress SQL Query: delete posts and post meta for posts older than N days
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DELETE p, pm | |
FROM wp_posts p | |
INNER | |
JOIN wp_postmeta pm | |
ON pm.post_id = p.ID | |
WHERE p.post_type = 'page' | |
AND p.post_date < (NOW() - INTERVAL 120 DAY); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment