Skip to content

Promoting WordPress changes from staging to production on cPanel

A reliable promotion workflow for moving WordPress changes from staging to production on cPanel — what to copy, what to leave behind, and how to verify.

Most WordPress staging-to-production failures come from copying too much. Database from staging overwrites recent orders. Files from staging include test plugins nobody wanted in production. The right promotion is selective, scripted, and reversible — not a one-click sync.

What’s happening

WordPress on cPanel typically uses one of two staging models: a separate cPanel account (most reliable, no shared state), or a subdirectory clone via WP Toolkit (faster to set up, but shares the parent account’s resources). Either way, the production site has continuously been accumulating new content (posts, orders, users) while staging was used for testing changes. The promotion is about merging the staging changes into a production that has moved on.

How to verify

Before promotion, document the diff:

# On staging:
wp plugin list --status=active --field=name > /tmp/staging-plugins.txt
wp theme list --status=active --field=name > /tmp/staging-themes.txt
wp option get siteurl

# On production:
wp plugin list --status=active --field=name > /tmp/prod-plugins.txt
wp theme list --status=active --field=name > /tmp/prod-themes.txt
wp option get siteurl

diff /tmp/staging-plugins.txt /tmp/prod-plugins.txt
diff /tmp/staging-themes.txt /tmp/prod-themes.txt

That tells you what changed in plugins and themes. The harder diff is database content — schema additions from plugin updates, but ideally not user-generated content.

The fix

The pattern that works:

  1. Take a production snapshot. Always. Before touching anything.

    wp --path=/home/prod/public_html db export ~/prod-pre-promotion-$(date +%F-%H%M).sql
    tar -czf ~/prod-pre-promotion-files-$(date +%F-%H%M).tar.gz -C /home/prod/public_html .
  2. Decide what’s promoting. The default split:

    • Files (themes, plugins, custom code): promote from staging to production.
    • Database content (posts, users, orders): stays on production. Never overwrite.
    • Database schema changes from plugin updates: apply on production by running the same plugin update.
    • Database settings (options) the staging changes touched: copy specific options, not the whole wp_options table.
  3. Sync files from staging to production:

    rsync -av --delete \
      --exclude='wp-config.php' \
      --exclude='.htaccess' \
      --exclude='wp-content/uploads/' \
      /home/staging/public_html/ /home/prod/public_html/

    Exclude wp-config.php (different credentials), .htaccess (production has production rewrites), and uploads/ (don’t overwrite production media with staging media).

  4. Update plugins on production to match staging:

    wp --path=/home/prod/public_html plugin update --all

    This applies any database schema changes the plugins need.

  5. Copy specific options that changed. If staging tested a new setting in plugin X, copy that one option:

    STAGING_VAL=$(wp --path=/home/staging/public_html option get plugin_x_setting --format=json)
    wp --path=/home/prod/public_html option update plugin_x_setting "$STAGING_VAL" --format=json

    Avoid blanket database sync — too easy to overwrite live data.

  6. If structural database changes are part of the promotion (a custom plugin you wrote added a table, a content type was added), apply them on production with explicit migration steps. WP-CLI commands, manual SQL, or whatever the plugin’s setup script does.

  7. Clear caches on production:

    wp --path=/home/prod/public_html cache flush
    wp --path=/home/prod/public_html lscache-purge all
    wp --path=/home/prod/public_html transient delete --all
  8. Smoke test. Homepage, key article, admin, checkout if e-commerce, form submission. Watch the error log live:

    tail -f /home/prod/public_html/error_log
  9. If something is wrong, roll back the files:

    tar -xzf ~/prod-pre-promotion-files-2026-05-19-1530.tar.gz -C /home/prod/public_html

    Database rollback uses the snapshot — but check first what production wrote since you started. The five-minute rollback might lose five minutes of orders.

For environments where promotion is a recurring operation, Stack Harbor handles the workflow under deployment management.

Stack Harbor operates production WordPress at scale — see enterprise WordPress operations for the managed model, or book a WordPress consult for a written read of your current shape.