Reputation: 175
A customer claims some posts on her wordpress site went missing when she deleted user accounts. Apparently, I really cannot find these posts in the database. (I first thought maybe they were not assigned to an author)
Now I have several full backups of the site as SQL files. One missing article is in there. However, we don't know exactly which articles went missing.
I only want to restore the missing articles. Not restore the whole site. Current articles should not be deleted!
What's the best way to achieve this? Import it to a different database and somehow compare wp_posts? Thanks guys!
Upvotes: 1
Views: 2506
Reputation: 2802
Hmmmm.... This can get tricky because there are comments, tags, categories, etc.. etc.. but I would do it like this but have not tested it:
p.s. might be worth posting on https://wordpress.stackexchange.com/ !!
Upvotes: 0
Reputation: 47321
You can create a temporary database,
and import your latest backup into it.
After that, do a
INSERT IGNORE INTO your_live_data.wp_posts
SELECT * FROM temporary_database.wp_posts WHERE user_id=xxx
The trick is the IGNORE will ignore to overwrite any existing items,
which mean only insert the missing posts.
NOTE : you should replace all related tables not just wp_posts alone
Upvotes: 2