Last active
October 11, 2024 03:10
-
-
Save loorlab/360855351bb3af056da35ceff11a8c35 to your computer and use it in GitHub Desktop.
Query - MySQL - WordPress | Display Post Revisions
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 | |
| p.ID AS original_post_id, | |
| p.post_title AS original_post_title, | |
| p.post_modified AS last_modified_date, | |
| r.ID AS revision_id, | |
| r.post_modified AS revision_date, | |
| u.display_name AS author_name, | |
| u.user_email AS author_email | |
| FROM | |
| wp_posts p | |
| LEFT JOIN | |
| wp_posts r ON r.post_parent = p.ID AND r.post_type = 'revision' | |
| LEFT JOIN | |
| wp_users u ON r.post_author = u.ID | |
| WHERE | |
| p.ID = 2804 -- ID Post | |
| ORDER BY | |
| r.post_modified DESC; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment