database - How would I see which wordpress posts have a revision history without opening each one?

I have about 3000 CPT records with ACF data that were updated incorrectly by WP All Import. Is there a way to see a list

I have about 3000 CPT records with ACF data that were updated incorrectly by WP All Import. Is there a way to see a list of posts with revision histories? I have already exported the database, but can't see any indicators that show if a single post has a revision.

Edit: Is there a specific database for post revisions?

I have about 3000 CPT records with ACF data that were updated incorrectly by WP All Import. Is there a way to see a list of posts with revision histories? I have already exported the database, but can't see any indicators that show if a single post has a revision.

Edit: Is there a specific database for post revisions?

Share Improve this question asked Feb 26, 2020 at 2:44 AndrewAndrew 235 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

From the Revisions documentation page:

Revisions are stored in the posts table.

Revisions are stored as children of their associated post (the same thing we do for attachments). They are given a post_status of inherit, a post_type of revision, and a post_name of {parent ID}- revision(-#) for regular revisions and {parent ID}-autosave for autosaves.

So you should be able to search the wp_posts table for posts where the post_type is revision, and then grab the post_parent ID to find the original post.

Update

If you're looking for an SQL query, here's one I just tried that seemed to work:

SELECT ID, post_title
FROM wp_posts
WHERE ID IN (
    SELECT DISTINCT post_parent
    FROM wp_posts
    WHERE post_type='revision'
);

...assuming your posts table has the default name wp_posts.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744712744a4589436.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信