Print

Syncing Posts From Production Site to Staging Site

Question:

How can I sync posts from my live site to my staging site (blog/dev)? There have been a lot of new posts while the staging site has been in development, and I don’t want to risk pushing my updates unless the posts are replicated across both environments

Answer:

You can use the WordPress internal export/import function. This allows you to export posts, pages, or media files from your live site.

After exporting the specific data you’ll get an XML file which you can import to the staging site.

You’ll find the Importer at wp-admin > Tools > Export / Import

How to Update Posts and Pages with WP STAGING?

To do so just click on the update button and select the tables wpstg_posts and wpstg_postmeta only.

Exclude and unselect all other tables and directories except the folders that contain your new images if there are any!

Attention: Updating means that posts and pages on the staging site will be overwritten with data from the live site!

These tables will be copied over to the staging site. If you have posts on the staging site that you do not have on the live site you should create them first on the live site to prevent these tables from being overwritten.

My advice for the future is to create content either on the staging site or to update the staging site more often. Then you make sure that both sites are not running much out of sync.

There is an article about the WordPress database structure which helps you to understand which database table contains data and makes your decision easier which table needs to be excluded when you copy over data from one site to another:

https://wp-staging.com/docs/the-wordpress-database-structure/

Updated on April 20, 2021