Created
October 28, 2024 18:16
-
-
Save kmwalsh/371ff5d691e270667417718916f62247 to your computer and use it in GitHub Desktop.
wp sql query - get all revisions prior to a specific date, unique to post ID
This file contains hidden or 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
select ID,post_author,post_title,post_parent from `wp_posts` where `post_type` = 'revision' AND `post_date` <= '2024-10-16 00:00:00' AND post_parent IN (SELECT post_parent FROM (SELECT post_parent, COUNT(post_parent) FROM wp_posts | |
GROUP BY post_parent | |
HAVING COUNT(post_parent) = 1) AS subQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment