Skip to content

WP Toolkit Staging on cPanel: Clone and Copy Data Safely

Build a WP Toolkit staging site on cPanel by cloning your live WordPress site, and test an update on the copy. Then push the result back with Copy Data without overwriting the orders and accounts the live site recorded in the meantime.

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 --info prints 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_html and staging at staging.example.com with 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 in wp_posts; the same rule applies to both.

How it works

Data flow between the live WordPress site and its WP Toolkit staging clone: Clone copies files and the whole database out and rewrites the URLs; Copy Data brings files and selected tables back; a red dashed arrow marks the one failure, copying the database only with all tables, which overwrites the orders and users recorded since the clone

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, default yes). 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). default copies every table except postmeta, posts, usermeta and users. all copies every table, minus any you name in -exclude-db-tables. new copies only tables the target lacks. selected copies only the tables you list in -db-tables.
  • Whether a restore point is made first (-create-restore-point, default yes), 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

  1. 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 -s

    Example 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       0

    space plus the site size must stay under limit. 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.

  2. Create the staging subdomain. In cPanel go to Domains and choose Create A New Domain. Enter staging.example.com and give it its own document root, /home/acme/staging.example.com, outside public_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.

  3. Clone the live site. On the live site’s card click Clone. Pick staging.example.com and 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_NAME

    Example output:

    https://staging.example.com
    https://staging.example.com
    acme_wp_stg7

    If siteurl still prints the live domain, the clone did not finish; check the task log on the staging card and the quota from step 1.

  4. 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_public

    Example output:

    0

    0 means WordPress asks search engines to stay away. A 1 means the site is still open to crawlers; wp option update blog_public 0 with the same --path closes it.

  5. 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 blocked

    The pre_wp_mail filter has been in WordPress since 5.7. Returning a non-null value makes wp_mail() return that value without sending, so true means 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 --raw

    Example output:

    Success: Added the constant 'DISABLE_WP_CRON' to the 'wp-config.php' file with the value 'true'.
  6. 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.com and set it to the same version as example.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
    done

    Example 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.

  7. 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 update

    Example 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.2

    wc update runs 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.

  8. 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 any wp_wc_orders* or wp_woocommerce_order_* table. The default mode still copies the WooCommerce order tables, so avoid it on a store.

    A files-only copy also carries the staging-no-mail.php blocker from step 5 (wp-config.php stays 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 flush

    Example 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 -s shows space at limit. 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 with wp --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-run if 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 list with the staging --path shows 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=active on staging for mail plugins and deactivate them there; the mu-plugin covers everything that goes through wp_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.