Recently, during a website makeover, I began working on a new site and while developing it, new comments had been added to the live site. As I had already made a copy of the site to work on at the start of the project, the latest comments wouldn’t have been included in my copy when I eventually restored it to the live site.
I looked at a few plugins to achieve this, but I found they had a few issues in the support section or they weren’t as easy as it should be – they needed you to create a CSV to import to etc. But there is an easier way.
By far the easiest way is to manually export 2 tables directly from PHPMyAdmin from the live site and import them into the dev site. Here’s how:
NB, it’s always good practice to backup the complete database of the dev site, just incase.
1. Open PHPMyAdmin of the original live site (where the new comments have been added).
2. Choose the Export tab:
3. Choose ‘Custom’ export method so you can choose specifically which tables to export (as we don’t need the whole site):
4. Choose the 2 comment tables – ‘wp_commentmeta’ and ‘wp_comments’ (both are needed):
5. Scroll down and save the export output to a file (you can name the file anything)
6. Save the file in a location you know on your computer (Downloads etc)
7. Once downloaded, open the dev sites’ PHPMyAdmin (the site thats missing the latest comments)
8. Select the same 2 tables in the database and either select both then DROP, or click DROP next to each one to delete both.
9. Once deleted, open the Import tab.
10. Choose the file we recently just saved to your computer in the File to Import section of the Import screen.
11. Once selected, press the Go button to import and voila! your database has been updated to include all the missing comments.
Hope this helps.