Print

Syncing Posts From Live 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: If you did not make any changes in the tables _posts and _postmeta on the staging website you can use WP Staging’s update function to update posts and pages on the staging site as explained below.

You can not use that method if you already made modifications to these tables as you would overwrite your modifications than.

Important: Keep in mind that WordPress stores all kind of data in the tables _posts and _postmeta. This includes menu entries, pages, posts, link to images, even visual elements if a visual editor is used!

Another option is to 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 than 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 so 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 contains 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 articles on the staging site which you do not have on the live site you should create them first on the live site to prevent that these tables are 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/