# Staging, copies and moving sites

> Try big changes on a copy first, know what a license needs on a copy or a local site, move the license to a new site, and move a site with a backup.

Large changes belong on a copy of the site, not on the live one. This guide shows how a copy works with PowerWP AI, which license it needs, how to move your license to a new site, how to move a whole site with a backup, and what the Environment setting does.

PowerWP AI does not create staging copies and does not push changes from a copy to the live site. Use your host's staging tool, a local copy, or a backup restored on another site.

## What you need

- **Backups & restore** to build backups through your AI app. You can do the same in wp-admin: **Create backup** and **Restore from your computer** are on **PowerWP AI › Backups**.
- **Database writes** if the new site has a different address and you replace the old one inside the database.
- A key for each public site. One license covers one site.

## Licenses on copies and local sites

| Where the site runs | License |
|---|---|
| `localhost`, `127.0.0.1`, `::1`, or an address ending in `.localhost`, `.test`, `.local`, `.example` or `.invalid` | A license key, like any site (since plugin 1.6.3). A paid plan covers one local copy without using up its site; a second one counts as a site. The plan's connection limit applies. |
| Any public address, including a staging subdomain | Its own license, because each public site needs one. |

A copy made from the database gets its own random installation id when PowerWP AI next runs at the new address, and remembers the id of the site it was copied from. Both are part of the daily update and license check. Nothing else about your content, customers or AI activity is sent.

> [!WARNING] PowerWP AI keeps its connections, memory, change history and license key in your database, so a copy made from the database can carry them. On the copy, open **PowerWP AI › Connections** and revoke what must not reach it, and check **PowerWP AI › License** before you connect an AI app.

## The Environment setting

In wp-admin open **PowerWP AI › Settings › General** and set **Environment** to Production, Staging or Development. It changes four things:

- **What your AI apps are told.** On Production they hear that this is a live site with real visitors and customers, and that they must be conservative: diagnose first, change only what the task needs, verify after every change. On Staging and Development they are only told the environment name.
- **A badge** with the environment sits in the top bar of the PowerWP AI screens.
- **The no-license notice** on the dashboard appears only on Production.
- **The daily update check** reports the environment.

It does not change permissions, rollback, plan limits or tools. A public site set to Staging still needs its license, and a live site set to Staging loses the extra care. An AI app cannot change the setting: PowerWP AI's own settings can only be changed by an administrator in wp-admin.

## Work on a copy first

:::steps
1. **Make the copy.** Use your host's staging tool, a local copy, or restore a PowerWP AI backup on another site (see below).
2. **Check the license on the copy.** A local address needs a key too: a paid plan covers one local copy without using up its site. A public address needs its own license.
3. **Set the environment to Staging.** In **Settings › General**, so your AI app knows it is not on the live site.
4. **Connect an AI app to the copy.** Create a new connection on the copy and revoke the ones that came with the database.
5. **Try the change there,** using the routine in [Work safely on a live site](/docs/guides/safe-workflow/).
   - Example prompt: `This is my staging copy. Do the plan we agreed, one step at a time, and write down every step and its result, so I can repeat it on the live site.`
   - Your AI app will use the tools for the job, with a checkpoint first.
6. **Check the copy,** then repeat the steps on the live site, with a fresh checkpoint there.
   - Example prompt: `Here are the steps that worked on staging: [paste]. Make a plan for the live site, with a checkpoint first, and wait for my OK.`
:::

> [!NOTE] A copy of a store can still send real e-mails and call real payment or webhook addresses until you switch those off. Check that before you test an order flow.

## Move the license to a new site

Deactivate the license on the old site, then activate the same key on the new one. The steps are in [Licenses and sites](/docs/account/licenses/#move-a-license-to-another-site). Connections on the old site are not revoked when you deactivate, but without a key they can only read, and no new one can be added there.

## Move a whole site with a backup

:::steps
1. **Back up the old site.**
   - Example prompt: `Make a full backup of this site, including the uploads folder, download it to my computer and confirm the download.`
   - Your AI app will use `backup_create` (type full), `job_status`, `backup_download_links` and `backup_confirm_downloaded`. The backup holds the database and the files. WordPress core is not in it by default, and neither are PowerWP AI's own tables.
2. **Prepare the new site.** Install WordPress, install and activate PowerWP AI, activate the license, and create a connection for your AI app. The restore keeps the new site's own PowerWP AI data, such as its connections and settings.
3. **Restore.** Open **PowerWP AI › Backups** and choose **Restore from your computer**. Select `manifest.json` and every `.sql.gz` and `.tar.gz` file of that one backup, choose what to restore (Database, Files), type the site's host name to confirm, and start. The site is in maintenance mode meanwhile.
4. **Fix the address.** If the backup came from another address, the screen warns that addresses inside the database are not rewritten.
   - Example prompt: `Replace https://old.your-store.com with https://your-store.com everywhere in the database. Run it as a dry run first and show me the matches per table.`
   - Your AI app will use `db_search_replace`. It handles serialized data and skips the `guid` column by default.
5. **Check the new site.**
   - Example prompt: `Check the home page, the shop, the cart and wp-admin for errors, and run the site health tests.`
   - Your AI app will use `page_check`, `error_log_read` and `site_health`.
6. **Copy the memory.** Backups leave it out. In **PowerWP AI › Memory**, use **Export** on the old site and **Import** on the new one.
:::

## Check the result

- The new site loads at its own address, with its own license shown in **PowerWP AI › License**.
- The badge at the top of the PowerWP AI screens shows the environment you chose.
- Your AI app's first answer from `site_overview` names the new address and the environment.

## How to undo

- Changes on a copy are recorded there. Roll them back in **Changes** on the copy. A search and replace is recorded too, cell by cell.
- A restore cannot be undone: it replaces the database and the files. Make a fresh backup of the target first if you may need today's state. Backups and restores are not recorded for rollback.
- Deactivating a license is reversed by activating the key again.

## Recipes that do this

No built-in recipe moves or copies a site. Use [safe_change](/docs/reference/recipes/#safe_change) on the copy, [before_plugin_updates](/docs/reference/recipes/#before_plugin_updates) to rehearse updates, and [setup_memory](/docs/reference/recipes/#setup_memory) to fill the memory of a new site.

:::cards
- [Backups and restore](/docs/safety/backups/) — What a backup holds and how to restore it.
- [Licenses and sites](/docs/account/licenses/) — One key, one site.
- [Activate your license](/docs/get-started/license/) — Keys and plans.
- [Work safely on a live site](/docs/guides/safe-workflow/) — The routine to rehearse.
:::

Source: https://powerwp.ai/docs/guides/staging/
