Question: How can I sync posts or pages 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: Exporting the posts or pages is the first step of the process and can be done with tools directly on WordPress. Be sure to perform the export from the production site to copy the posts or pages to the staging site.
Export Posts or Pages From WordPress
1. Log in to the production site wp-admin.
2. Navigate to Tools > Export
3. Choose posts or pages for export:
Warning: Choose posts or pages only! Selecting all content would overwrite all posts, pages, and media. This may result in losing the changes made on the staging site.
4. Click on Download Export File.
Import Posts or Pages to WordPress
Importing posts or Pages into the staging site requires you’ve first exported the content from the production site. Make sure you’ve downloaded the *.XML file from the previous step. Make sure to perform the import process on the staging site.
1. Log in to the wp-admin dashboard of the staging site
2. Navigate over Tools > Import. If you do not have the WordPress importer installed, you will see a prompt to install the plugin and must do so before continuing
3. Scroll down to WordPress and click Install Now
4. Now click on the Run Importer
5. Click on choose file and select the *.XML file
6. Click on the Upload file and import button.
7. Assign posts to existing, WordPress users, and make sure to check the Download and import file attachments.
9. Finally, click on the Submit button.
10. All done, the new posts are imported, and already existing posts are not touched.
Alternative Option: Update Posts and Pages with WP STAGING
To do so, click on the WP STAGING update button and select the tables
Exclude and unselect all other tables and folders except the folders that contain your new images, if there are any!
Attention: Updating means that ALL 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 there are posts on the staging site that you do not have on the production site, you should create them 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 ensure that both sites are not running much out of sync.