Moving changes from staging to live
You move changes by "pushing" the copy to the live site. Hosts and plugins do it in different ways. The main risk is the same everywhere. Whatever you push can overwrite what's already there.
What you need first
- A fresh backup of the live site. The WordPress handbook advises a backup before any upgrade. With one, you can1 "quickly restore things back to normal" if the push goes wrong.
- A list of what you changed on the copy, in files and in the dashboard.
- A note of anything that changed on the live site since you made the copy, such as orders, comments or new pages.
- A quiet moment on the live site, if you can pick one.
Ways to move changes
A host's push tool. Hosts with staging usually let you copy one environment onto another. WP Engine says you can2 "use development to create and test a new design, then copy those changes to" production. Kinsta describes a "push" from staging to live in its own steps.3
A plugin. The WP STAGING page lists pushing as a paid-edition feature:4 "Push staging changes to production (staging to live), including plugins, themes, and media files, with one click." The page says these features4 "are available in WP STAGING | PRO". Other plugins work differently, so read their own pages.
By hand. With a copy you built yourself, you copy files across and, if needed, export and import database tables. It's slower and it's easy to overwrite the wrong thing. Take your time.
Files or database?
This choice decides what gets overwritten. Two parts of a site move separately:
- Files: theme files, plugin files, media.
- Database: posts, pages, comments, users, orders and most settings.
If you push the database, the live site's database can be replaced by the copy's. Anything the live site collected since you cloned it, such as orders or comments, is at risk.
Kinsta spells out the files-only option.3 It says "when pushing only the files, this means that the database on the live site remains unchanged, and only files on the live site will be overwritten".
For a pure design change, it says to3 "select Files and make sure Database is not selected". That only works if you changed nothing in the dashboard on the copy, including plugin, theme or customiser settings.
What a push can miss
A files-only push can leave things behind. Kinsta gives an example:3 "pushing only the files from staging to live will not create the database tables for that plugin". A new plugin installed on the copy may not be set up properly on the live site. Settings kept in the database don't come along either.
The fix, Kinsta says, depends on how the plugin is coded. Enabling it on the live site may create the tables. Check the plugin's own help.
What a push can overwrite
Some overwrites aren't obvious:
- Live data. A database push can replace newer orders, comments or sign-ups.
- Scheduled jobs. Kinsta warns that if you change the crontab on staging and3 "push staging to your live environment, it will overwrite your live environment’s crontab".
- Host settings that aren't pushed. Kinsta says its bot protection setting isn't transferred, so you'd set it on live separately.3 WP Engine says its host configurations aren't copied by its copy tool either, so don't assume they match.2 The page on what a copy carries over has the details.
- Privacy settings. If the copy was hidden from search engines, make sure that didn't follow the push to the live site. Keeping a staging site private and out of search results explains the settings.
Selective pushes
You don't have to push everything. For shops, Kinsta mentions a choice.3 You can "push files only so your database is not overwritten". Or you can push chosen database tables and leave out the shop tables. That's detailed work. Kinsta recommends working with a developer if you're unsure which tables to push.
The same idea runs the other way. When the live site has moved on, Kinsta says3 you can "use a selective push to update your staging environment" instead of rebuilding it.
After the push
Open the live site in a private window. Click through the pages you changed. Test forms, checkout and login. Look for old cached pages, and clear caches if your host or plugin has them.
A checklist before pushing staging changes live lists what to look at before and after.
Reference list
- Backups, WordPress Advanced Administration Handbook
- Sites and environments, WP Engine
- Staging Environments, Kinsta
- WP STAGING plugin page, WordPress.org
