Being able to easily merge two different site databases is a complex process but luckily Nexcess provides a solid plugin which deals with just that exact issue. The WPMerge plugin is provided on all Managed WordPress and Managed WooCommerce plans.
Using the WPMerge plugin will allow you to push a connected staging site to the production site but it will not replace data that you need on the production site. As an example, you might run WooCommerce on your site and when you move from staging to production you don’t want to replace customers and orders.
Initial Setup
The WPMerge plugin needs to be installed on both the staging and production sites, licensed, and then configured so that the two sites may communicate back and forth. If a staging site hasn't yet been created, this will only need to be done once as the configuration will be copied over when the site is cloned to create a staging site.
Fortunately, the Nexcess Installer handles most of this work for you. On the Nexcess > Install Plugins screen, select "WPMerge" (under the "Support" heading), then click "Install Selected Plugins." This will handle installing and activating WPMerge on the current site (please remember to do this again in other environments if they already exist), along with creating a WPMerge.io account.
After installation, you will be asked to specify whether the site is a production site or a development site; choose "This is a production site" for production and "This is a development site" for staging/development sites.
Meanwhile, the staging site will ask you to log into your WPMerge.io account, which will have been created for you automatically. Reset your WPMerge.io password, using the email address associated with your WordPress user.
Credentials in-hand, log into your WPMerge.io account from within the "WPMerge" screen within WP Admin. Once successfully connected, paste the connection string provided by production and click "Connect".
On the production site, you will be shown a "Connect Dev & Prod WPMerge Plugins" meta box, which gives you a JSON string that will need to be pasted into the development site(s) under WPMerge > Settings > Connect.
WPMerge > Settings
After you have made changes to your staging site now you can test merging the data from the staging site to the production site.
Note: If you're using a security plugin such as Wordfence, you may need to temporarily disable the plugin while establishing the initial connection, as Wordfence has been known to try to block the connection request from staging sites.
Day-to-day usage
Once WPMerge has been configured, content changes will be tracked and can be copied between environments at-will through the WPMerge screen in WP Admin.
WPMerge > WPMerge
The first will show the changes that have been recorded on the staging site, you can test applying the changes which will clone the production database and then apply the changes to the staging site.
Next, you can test merging in the staging site. It is recommended to test merging in the staging site before pushing the changes to the production site.
The last option is to push the changes made in the staging site and then push those to the production site.
File Differences
Any file differences between the staging site and the production site can be downloaded in the form of a zip file which will need to be unzipped and then uploaded to the production site.
Clearing Caches
Anytime sites are merged, it's important to flush relevant caches on the modified site, as WPMerge doesn't do this automatically.
Most sites will take advantage of an object cache, and flushing this cache can be done via the "Nexcess" menu in the WP Admin Bar:
If a plugin like Cache Enabler is also being used, its cache should be cleared as well. It adds a "Clear Cache" button to the right side of the Admin Bar, but it may also be cleared via Settings > Cache Enabler (the "Save Changes and Clear Cache" button).
Similarly, page builders such as Elementor, Beaver Builder, and Divi. may have their own caches to clear and will generally be available under those plugins' settings. If your production site domain is using a CDN then you should also clear the CDN cache.
WPMerge is an easy to use plugin which will make it easy to be able to push staging site changes to the production site. It will just take a short while to get used to the new development workflow process. Also, remember not to use a migration service or plugin to clone the staging site to replace the production site if using WPMerge on the site.
For 24-hour assistance any day of the year, contact our support team by email or through your Client Portal.