You run a live WordPress site on a cPanel account with WP Toolkit, the WordPress manager that ships with cPanel. You want a staging site, a private copy where an update can fail without cost, before the next change reaches real visitors. The hard part is the trip back: the tested result must reach the live site without erasing the orders, accounts and comments recorded while you were testing. WP Toolkit’s Clone tool makes the copy and its Copy Data tool pushes files and chosen database tables back. The safe pattern is files plus only the tables your change touched, leaving every table customers write to alone.
What you’ll accomplish
- A staging copy of the live site on its own subdomain, with its own database, made by WP Toolkit in one action.
- A staging site hidden from search engines, behind a password, unable to send email or run scheduled jobs against real customers.
- Staging on the same PHP version and plugin versions as production, so a test there means something.
- A Copy Data push back to production that carries files and the tables you changed, and never the order or user tables.
- A check that proves both sites match where they should and differ where they must.
Prerequisites
- A cPanel account with WP Toolkit Deluxe. As of 27 October 2026, the feature table on the WP Toolkit page at docs.cpanel.net ticks “Staging and Cloning” for WP Toolkit Deluxe only. Maintenance Mode, Password Protection, Search Engine Indexing Management and Debug Management are ticked for both editions. If your site’s card has no Clone or Copy Data button, the account does not have Deluxe. Use the manual method in promoting WordPress changes from staging to production on cPanel instead.
- SSH access as the cPanel user, and WP-CLI (the WordPress command line) on the server;
wp --infoprints its version. - Free disk space of at least the size of the live site. The clone is a full second copy of files and database.
- A subdomain for staging. The examples use the account
acme, the live site at/home/acme/public_htmland staging atstaging.example.comwith document root/home/acme/staging.example.com. - WordPress 6.x and WooCommerce 8.2 or newer in the examples. From 8.2, WooCommerce keeps orders in dedicated tables called HPOS (High-Performance Order Storage) instead of inside
wp_posts. Older stores keep orders inwp_posts; the same rule applies to both.
How it works
Clone copies the live site’s files into the target document root, creates a new database with a generated name and imports the live data into it. It then points the copy at the staging domain, so you do not run a search-replace yourself. The result appears in WP Toolkit as a second site with its own card.
Copy Data moves content between two sites WP Toolkit manages. You open it on the source site’s card and choose the Target. The form asks the same questions as the toolkit’s command line, documented in the WP Toolkit command line interface reference, so the flag names below are a precise way to name each choice:
- What to copy (
-data-to-copy): files and database (all), files only (files) or database only (db). - Whether files already modified on the target are replaced (
-files-replace-modified, defaultyes). On, a source file overwrites the target’s copy even when the target’s is newer. - Whether files missing from the source are removed from the target (
-files-remove-missing). On, a target file with no counterpart on the source is deleted. - Which tables to copy (
-db-tables-copy-mode).defaultcopies every table exceptpostmeta,posts,usermetaandusers.allcopies every table, minus any you name in-exclude-db-tables.newcopies only tables the target lacks.selectedcopies only the tables you list in-db-tables. - Whether a restore point is made first (
-create-restore-point, defaultyes), so you can roll the target back from its card.
The one failure in the diagram is a database copy from staging to production with every table and nothing excluded. Production has two writers for as long as staging exists: you on staging, and every customer on the live site. A table copied whole replaces the live table, so every order, account, comment and form entry recorded since the clone disappears. The default mode protects posts and users, but its exclusion list stops there. By that list, wp_comments (where WooCommerce keeps order notes) and the HPOS order tables such as wp_wc_orders, wp_wc_orders_meta and wp_woocommerce_order_items are copied whole. The per-table reasoning is in WordPress staging to production: what moves and what never moves.
Each site keeps its own wp-config.php, so database credentials never cross between the two.
Step-by-step
-
Confirm the edition and the space. Open WP Toolkit in cPanel and find the live site’s card. It must show Clone and Copy Data. Then check that the account can hold a second copy.
du -sh /home/acme/public_html quota -sExample output:
3.4G /home/acme/public_html Disk quotas for user acme (uid 1012): Filesystem space quota limit grace files quota limit grace /dev/vda1 3482M 10240M 10240M 41203 0 0spaceplus the site size must stay underlimit. Here 3.4 GB used plus a 3.4 GB clone is 6.8 GB of 10 GB, so the clone fits. If it does not, see Troubleshooting first. -
Create the staging subdomain. In cPanel go to Domains and choose Create A New Domain. Enter
staging.example.comand give it its own document root,/home/acme/staging.example.com, outsidepublic_html, so neither site ever sits inside the other’s tree. Wait for the subdomain’s certificate; the SSL/TLS Status page shows AutoSSL progress. -
Clone the live site. On the live site’s card click Clone. Pick
staging.example.comand its document root as the destination. WP Toolkit proposes a database name; keep it. Start the clone and wait for the task to finish, then confirm the URL rewrite from the shell:wp --path=/home/acme/staging.example.com option get siteurl wp --path=/home/acme/staging.example.com option get home wp --path=/home/acme/staging.example.com config get DB_NAMEExample output:
https://staging.example.com https://staging.example.com acme_wp_stg7If
siteurlstill prints the live domain, the clone did not finish; check the task log on the staging card and the quota from step 1. -
Hide staging from the outside world. Do this before anyone opens the site, because a clone carries every live setting with it. On the staging card, switch off search engine indexing and switch on Password Protection, which makes the browser ask for a username and password before WordPress loads. Leave Maintenance Mode off; it hides the site from you too. Then confirm that WordPress’s own crawler setting agrees:
wp --path=/home/acme/staging.example.com option get blog_publicExample output:
00means WordPress asks search engines to stay away. A1means the site is still open to crawlers;wp option update blog_public 0with the same--pathcloses it. -
Stop staging from emailing real customers. The clone has the live mail settings, the live payment keys and the live customer list. A test order on staging would send a real confirmation. Block every outgoing message with a must-use plugin, a file in
wp-content/mu-plugins/that WordPress loads on its own and that nobody can switch off from the dashboard:mkdir -p /home/acme/staging.example.com/wp-content/mu-plugins cat > /home/acme/staging.example.com/wp-content/mu-plugins/staging-no-mail.php <<'EOF' <?php # Staging only: short-circuit every wp_mail() call so no message leaves this site. add_filter( 'pre_wp_mail', '__return_true', 10, 2 ); EOF wp --path=/home/acme/staging.example.com eval 'echo has_filter("pre_wp_mail") ? "mail blocked\n" : "mail LIVE\n";'Example output:
mail blockedThe
pre_wp_mailfilter has been in WordPress since 5.7. Returning a non-null value makeswp_mail()return that value without sending, sotruemeans every message reports success and goes nowhere. Then switch payment gateways to test mode under WooCommerce → Settings → Payments, and stop WordPress’s scheduler so staging never publishes scheduled posts or renews subscriptions:wp --path=/home/acme/staging.example.com config set DISABLE_WP_CRON true --rawExample output:
Success: Added the constant 'DISABLE_WP_CRON' to the 'wp-config.php' file with the value 'true'. -
Match PHP and plugin versions. A new subdomain gets the server’s default PHP version, which may differ from the live domain’s. In MultiPHP Manager, tick
staging.example.comand set it to the same version asexample.com. Then compare both sites:for p in /home/acme/public_html /home/acme/staging.example.com; do echo "== $p" wp --path=$p eval 'echo PHP_VERSION, PHP_EOL;' wp --path=$p core version wp --path=$p plugin list --update=available --fields=name,version,update_version doneExample output:
== /home/acme/public_html 8.3.14 6.9.1 +-------------+---------+----------------+ | name | version | update_version | +-------------+---------+----------------+ | woocommerce | 9.7.1 | 9.8.2 | +-------------+---------+----------------+ == /home/acme/staging.example.com 8.3.14 6.9.1 +-------------+---------+----------------+ | name | version | update_version | +-------------+---------+----------------+ | woocommerce | 9.7.1 | 9.8.2 | +-------------+---------+----------------+The two blocks must be identical before you change anything. A plugin that passes on PHP 8.3 and fails on 8.1 is exactly what staging exists to catch.
-
Run the update on staging and test it. Apply the change on staging only, then place a test order through the checkout in test mode and note its number.
wp --path=/home/acme/staging.example.com plugin update woocommerce wp --path=/home/acme/staging.example.com wc updateExample output:
Enabling Maintenance mode... Downloading update from https://downloads.wordpress.org/plugin/woocommerce.9.8.2.zip... Unpacking the update... Installing the latest version... Removing the old version of the plugin... Plugin updated successfully. Disabling Maintenance mode... +-------------+-------------+-------------+---------+ | name | old_version | new_version | status | +-------------+-------------+-------------+---------+ | woocommerce | 9.7.1 | 9.8.2 | Updated | +-------------+-------------+-------------+---------+ Success: Updated 1 of 1 plugins. Found 2 updates (9.8.2) Success: 2 update functions completed. Database version is 9.8.2wc updateruns the plugin’s own database upgrade on staging, so you see its effect before production. Walk the pages that earn money: a product page, the cart, the checkout, the order received page. Write down the test order number; the validation section checks that it never reaches production. -
Copy Data back to production. On the staging card click Copy Data and set Target to
example.com. Read the target name twice; it is the one field with no undo except the restore point. Then:- Choose files only when the change is code (a plugin, theme or core update, a CSS fix). This is the common case.
- Leave the replace-modified-files option on, so the updated plugin files win.
- Leave the remove-missing-files option off. With it on, every image uploaded to the live site since the clone is deleted, because those files do not exist on staging.
- Leave the restore point on.
- Choose files and database only when the update created tables of its own. Then use the selected-tables mode and tick those tables by name. Never tick
wp_posts,wp_postmeta,wp_users,wp_usermeta,wp_comments,wp_options, or anywp_wc_orders*orwp_woocommerce_order_*table. Thedefaultmode still copies the WooCommerce order tables, so avoid it on a store.
A files-only copy also carries the
staging-no-mail.phpblocker from step 5 (wp-config.phpstays per site, so the cron constant does not travel). Remove the blocker on production right after the copy, then run the database upgrade and clear caches there:rm /home/acme/public_html/wp-content/mu-plugins/staging-no-mail.php wp --path=/home/acme/public_html eval 'echo has_filter("pre_wp_mail") ? "mail blocked\n" : "mail live\n";' wp --path=/home/acme/public_html wc update wp --path=/home/acme/public_html cache flushExample output:
mail live Found 2 updates (9.8.2) Success: 2 update functions completed. Database version is 9.8.2 Success: The cache was flushed.Content written on staging (a redesigned page, new products) moves by export and import, never by table copy; the staging to production article shows how.
Validate it works
Run the comparison again. Both sites must show the new plugin version and an empty update table:
for p in /home/acme/public_html /home/acme/staging.example.com; do
echo "== $p"; wp --path=$p option get siteurl; wp --path=$p core version
wp --path=$p plugin get woocommerce --field=version
wp --path=$p plugin list --update=available --fields=name,version,update_version
done
Example output:
== /home/acme/public_html
https://example.com
6.9.1
9.8.2
== /home/acme/staging.example.com
https://staging.example.com
6.9.1
9.8.2
siteurl differs, everything else matches, and the update table prints nothing. Now prove that live data survived and staging data stayed put. The first query lists the newest live orders; they must include orders placed after the clone. The second looks for the staging test order number from step 7 and must print nothing.
wp --path=/home/acme/public_html db query "SELECT id, status, date_created_gmt FROM wp_wc_orders ORDER BY id DESC LIMIT 3"
wp --path=/home/acme/public_html db query "SELECT id FROM wp_wc_orders WHERE id = 20488"
Example output:
+-------+---------------+---------------------+
| id | status | date_created_gmt |
+-------+---------------+---------------------+
| 20486 | wc-processing | 2026-10-27 15:41:07 |
| 20485 | wc-completed | 2026-10-27 13:08:52 |
| 20484 | wc-processing | 2026-10-27 09:17:30 |
+-------+---------------+---------------------+
Finally place one small real order on the live checkout and confirm its confirmation email arrives. That closes the loop on the mail blocker removal.
Troubleshooting
- The clone stops with a disk space or quota error. The task log on the staging card reports a failed file copy or database import, and
quota -sshowsspaceatlimit. cPanel’s Disk Usage page shows which directory is large; old backup archives in the home directory are the usual cause. Delete the half-made staging site from its card before cloning again. - Staging shows a padlock warning or unstyled pages (mixed content). The subdomain has no certificate yet, or hard-coded
http://links remain. Run AutoSSL from SSL/TLS Status, then look for leftovers withwp --path=/home/acme/staging.example.com search-replace 'http://staging.example.com' 'https://staging.example.com' --dry-run. It prints the tables that still hold the plain address; rerun without--dry-runif any count is above zero. - A scheduled post went live on staging, or a subscription renewed twice. WordPress’s scheduler ran on the clone.
wp cron event listwith the staging--pathshows what is queued; the constant from step 5 stops it, which is why step 5 comes before any testing. - A real customer received an email from staging. The blocker was added after the first test, or a mail plugin sends through its own transport. Check
wp plugin list --status=activeon staging for mail plugins and deactivate them there; the mu-plugin covers everything that goes throughwp_mail(), which is every core and WooCommerce message. - Premium plugins show as unlicensed on the clone. Commercial licences are usually bound to the domain; some vendors allow a
staging.subdomain at no charge, others do not. An unlicensed plugin still runs but stops receiving updates, so upload the new version by hand on staging for the one plugin you are testing.
When this is the wrong approach
The clone lives inside the same cPanel account as the live site, so it shares the account’s CPU, memory and disk limits, and a heavy test slows the live site. For load tests or long imports, put staging in a separate account or server and promote with WP-CLI and rsync as in the cPanel promotion workflow. The toolkit is also the wrong tool when editors write content on staging that must reach production whole. Copy Data cannot merge two histories of wp_posts, and export-and-import only scales to a handful of pages.
Running WordPress that earns real money deserves an operator — Stack Harbor runs that stack under Enterprise WordPress; book an infrastructure consult.