# Copy content between environments

> Copy database tables and uploads between environments, push or clone into staging and previews with a 48 hour undo, or copy into live with a typed confirmation.

Source: https://docs.wpwaterfall.com/push-environments

Copying content moves database tables and uploads folders from one environment of a site to another. Use it to refresh staging or a preview from live, to move content between previews, or to put the content you built on staging onto live, such as new pages, products, or media.

Code never moves this way. Plugins, themes, and your other code move through Git, by a merge or a deploy, and each builds a release from a commit. See [Environments](https://docs.wpwaterfall.com/environments) and [Push code to staging and promote](https://docs.wpwaterfall.com/push-code-to-staging).

Every copy takes a restore point of the target first. Copying into live asks for more, because it changes the site your visitors use.

## Which one do I use?

| You want to | Use | Restore point |
| --- | --- | --- |
| Copy into staging or a preview | **Push environment**, or **Clone database and files** | Kept 48 hours, and **Undo push** restores it |
| Copy into live | **Clone database and files** with **Live** as the target | Kept 14 days, and you restore it from **Backups** |

Both start from the environments you can reach on **Manage environments**.

## Copy into staging or a preview

Open the environment you want to copy from, then choose **Push environment** in the header of its **Info** page and pick the target. You can also choose **Push this environment here** in the row menu of the target on **Manage environments**. The menu is off while a job runs on the environment, and says why. The entry **Push to Live** is not a content copy: it opens the deploy flow, which moves code. Live is never the target of a push. To put content into live, [copy into live](#copy-into-live).

Under **Manage environments**, the **Clone database and files** card does the same from the other side: pick the source under **From environment**, the target under **To environment**, tick **Clone database**, **Clone files (uploads)**, or both, and choose **Clone to** the target. Tick **Clear caches after the clone** to purge the target's cache when it ends.

### What you pick

1. **Target.** Staging, a preview, or another environment on this site that is not live.
2. **Tables.** All tables, none, or the ones you tick.
3. **Uploads.** All uploads folders, none, or the folders you tick. A copy replaces the folders you pick. A link does not count as a folder: if a folder you name is a link, or sits behind one, in the source or in the target, the copy stops before it changes anything and names the folder.
4. **Hostnames.** WP Waterfall replaces the source hostname with the target's main hostname in the database, so links keep working on the target.
5. **Confirm.** Type the target site's name. The copy does not start until the name matches.

Target-only settings never move. That includes domains, custom Nginx rules, PHP settings, and SSH host keys.

### Undo a push

Before a push changes anything, WP Waterfall takes a restore point of the target. It is kept for 48 hours. To undo a push, open the bell, select the finished push job, and choose **Undo push** in its details. Confirm, and WP Waterfall restores the target from that restore point. The restore runs as its own job, and its details open in the same place. Changes made on the target since the push are lost. **Undo push** shows to people whose role may change environments, such as Owners, Admins, and Developers.

- Undo works once for each push.
- After 48 hours the restore point expires, and **Undo push** goes away. A finished push leaves the bell after 24 hours: after that, undo it through the API or the MCP tool `undo_push`.

## Copy into live

Copy into live puts the database tables and uploads of staging, or of a preview, onto your live site. It takes a restore point of live first, and it does not start until you have typed live's address.

### Where to find it

Open **Manage environments** and use the **Clone database and files** card. Pick staging or a preview under **From environment**, pick **Live** under **To environment**, tick **Clone database**, **Clone files (uploads)**, or both, and press **Clone to Live**. Live is a target only if your role may deploy and update environments: Owners, Admins, Developers, and the Site Admins and Site Developers of this site. For everyone else the list leaves Live out. Live is never a source here.

### Step one: change what to copy

The card opens the red step (step two) first, with the database and files you ticked on the card. Nothing is sent yet. Choose **Back** to reach step one and fine tune the copy:

1. **Copy from.** A running staging or preview environment of this site, on the same server as live.
2. **Tables.** Ticking **Clone database** on the card selects **Every table**, and leaving it off selects **No tables**. Choose **Every table** or **Some tables** and tick the ones you want. The list shows each table's size.
3. **Uploads.** Ticking **Clone files (uploads)** selects **All uploads**, and leaving it off selects **No uploads**. Choose **All uploads** or **Some folders**. Uploads are added to live's: new files and newer files arrive, files that only live has are kept, and a newer live file stays unless you tick **Replace files that differ on live**.

**Continue** stays off until you pick at least one table or one uploads folder.

### Step two: read the warning and confirm

The next step has a red border. It says:

- This replaces the selected tables on live with the ones from the source.
- Orders, users, comments, and form entries created on live since the source was last refreshed are overwritten.
- If live runs WooCommerce, do not copy the database while live takes orders, unless you mean to replace them.
- Live may be briefly slow while the copy runs.
- WP Waterfall takes a restore point of live first, keeps it 14 days, and you restore it from **Backups** on live.

It also shows how many tables and how much data it will replace, and how many tables live keeps because the source does not have them. To go on, tick **I understand that live's data is replaced**, type live's address (or the site name) exactly, and press **Copy into live**. The button stays off until both are right.

### What stays as it is on live

- **Tables the source lacks.** A copy replaces only the tables you chose. Other tables on live stay.
- **Search engine visibility.** Staging hides itself from search engines and live does not. Live keeps its own setting.
- **WP Waterfall settings.** Cache and edge settings, password protection, and login settings stay.
- **User roles.** Live keeps its own role definitions.
- **Keys and salts.** They live in `wp-config.php`, which a copy never touches.
- **Tables that belong to WP Waterfall.** They never move.

In the copied tables, WP Waterfall replaces the source's address with live's main address, so links keep working. On a Multisite network, each subsite keeps live's host.

### While it runs and after

WP Waterfall works in this order, and each step is its own job in the bell:

1. It takes the restore point of live. If that fails, nothing on live changes and the copy does not start.
2. It copies the tables and the uploads.
3. It clears live's caches and the edge cache.
4. It checks that live's home page answers.

If live's home page does not answer, the job fails and says which restore point to use. When the copy finishes, the owners get a notification, and so does the person who started it. **Activity** shows who copied what, and the job result names the restore point.

### Undo a copy into live

Open **Backups** on live and restore the restore point named **Before copying staging into live** (or the name of the preview). It stays 14 days, and it does not count toward your five manual snapshots. Restoring it needs the same permissions as the copy.

## API and MCP

- `POST /v1/environments/{id}/push` starts a push from that environment into another environment on the same site. It answers with a job. `GET /v1/environments/{id}/pushes` lists the pushes into an environment, and `POST /v1/pushes/{id}/undo` restores the target from the push's restore point.
- `POST /v1/environments/{id}/clone-content` copies into a staging or preview environment from another one.
- Copy into live has two routes: `GET /v1/environments/{id}/copy-into-live/preview` (where `{id}` is live) and `POST /v1/environments/{id}/copy-into-live`. The request needs `confirm: true`, `confirm_live: true`, and `live_name_confirmation`. A missing one answers 422 and names it. An API key needs the `backups:restore_live` scope, the same as restoring live. A plain push into live answers 409 with the code `use_copy_into_live`.
- The MCP tool `copy_into_live` asks in two steps. The first call returns the warning and the sizes. After you answer, the second call sends the confirmations and the address you typed. The tools `push_environment` and `undo_push` cover a push.

## Related

- [Environments](https://docs.wpwaterfall.com/environments)
- [Push code to staging and promote](https://docs.wpwaterfall.com/push-code-to-staging)
- [Backups](https://docs.wpwaterfall.com/backups)
- [Sleeping environments](https://docs.wpwaterfall.com/sleeping-environments)
- [Jobs and progress](https://docs.wpwaterfall.com/jobs-and-progress)
