What a staging copy includes and what it leaves out
A staging copy normally carries your files and your database, so it looks like the live site. Host-level settings are another matter. Hosts say some of those don't come across, and a few things that do come across can cause trouble.
What you need to know first
- Which tool made the copy. A host's button, a plugin and a hand-made copy each carry different things.
- Whether your site keeps media (photos, downloads) on the same server or somewhere else.
- Whether the site sends email, takes orders or runs scheduled jobs.
Read your own tool's documentation for the final word. The examples here come from three public sources.
Files and database
Kinsta describes a clone this way.1 It will "contain the most recent version of your production database and files for testing." That covers the usual core: pages, posts, comments, users, theme files and plugin files.
"Most recent" means as of the moment of copying. Anything added on the live site afterwards, such as a new order, isn't in the copy.
Media
Photos and uploads sit in the files, so they usually come across with the rest. There's an exception. WP Engine explains that when a site uses its LargeFS feature,2 "media is stored off-site which means these files cannot be copied by our server". The page says support can set up a fall-back rule for staging.
If your photos live on an outside storage service or content network, check what the copy actually points to.
Addresses and links
A copy has a different web address from the live site. Tools have to change the addresses stored in the database, or links on the copy would send you back to the live site.
The WP STAGING plugin page says this is done for you.3 It "automatically performs search and replace for links and paths" when it clones.
WordPress can also be told its address in the wp-config.php file. The handbook explains that4 "WP_HOME overrides the wp_options table value for home but does not change it in the database". If a copy shows the wrong address, a setting like that is one place to look.
Settings: what comes across and what doesn't
Settings stored in the database usually travel with it. Settings kept by your host often don't. WP Engine says its own configurations2 "will not be copied when using the Copy Environment tool". Its list says redirect rules, custom cache exclusions, SSL certificates and Nginx rules need Support to copy them. Web rules can be duplicated from the User Portal.
For redirects, its note reads2 "Reach out to Support to have redirects copied".
Some things do copy, and you may not want them to:
- Kinsta says that if you clone a site with SSL,1 "SSL will also be enabled on your staging site."
- A plugin that changes your login address carries it over:1 "the custom part of the URL will get copied over to the staging site".
The table sums up what these sources say.
| Part | Usually in the copy? | Source says |
|---|---|---|
| Files | Yes | Cloning gives you current files |
| Database | Yes | Cloning gives you the current database |
| Media stored on the server | Yes | Part of the files |
| Media stored off-site | Not always | One host says its server can't copy it |
| Host-level settings (redirects, certificates, server rules) | Not always | One host lists these as not copied |
| Scheduled server jobs | Not active on staging | Kinsta says live cron jobs aren't active on the staging environment, even after a clone |
Scheduled jobs
Kinsta states that1 "Server cron jobs from the live environment are not active in the staging environment". That's useful. A copy won't run every scheduled task your live site does.
Email and orders
This one catches people. Kinsta says that1 "Staging environments have mail-sending (transactional email) enabled by default." A test order on the copy can send a real email to a real address.
Shop data is copied too. The WP STAGING page says it clones WooCommerce stores,3 "including orders, products, and customer data." Real customer data now sits in a second place. If you need to avoid that, look at the privacy rules that apply to you and ask your lawyer or the official body, such as the OAIC in Australia.
The page on keeping a copy private covers locking the copy down. When you're ready to send changes back, read about pushing the copy to the real site.
Reference list
- Staging Environments, Kinsta
- Sites and environments, WP Engine
- WP STAGING plugin page, WordPress.org
- Editing wp-config.php, WordPress Advanced Administration Handbook
