Menu
All schedule 10 min read

WordPress Staging to Production: A Deployment Checklist

Faraz Frank

Faraz Frank

November 30, 2026

WordPress Staging to Production

The push button says “deploy.” It copies files and a database. What it does not do is rewrite the staging URL inside serialized data, flush the object cache, reset the cron schedule, or turn indexing back on. Those four omissions account for most of the “the site is live and something is wrong” calls that follow a deployment.

This is the sequence to run instead: what to do before the push, the exact order during it, and how to verify the result before you walk away. If the staging copy does not exist yet, start with the staging site setup guide; this piece picks up at the moment before the push.

What a staging push actually moves

A WordPress site is three things:

  • Files in wp-content — themes, plugins, uploads, and any generated CSS.
  • A database — posts, options, users, orders, and the home and siteurl values that define the domain.
  • Configuration — wp-config.php, server rules, cron, and the cache layer.

A deployment plugin typically copies the first two and leaves the third to you. That is why the same button produces different results on different hosts: the plugin is not the variable, the environment is.

The rule that prevents most incidents: treat the domain change as a data migration, not a file copy. Every place the staging hostname appears — options, post meta, widget settings, page builder JSON, serialized arrays — has to change, and it has to change without corrupting serialized strings.

The five failures that actually happen

1. Serialized data corrupted by a naive find-and-replace

Page builder settings, theme customizer values, and widget options store arrays as serialized PHP strings. Those strings include a byte count:

s:22:"https://staging.example.com";

Replace the URL with a shorter or longer one and the byte count no longer matches. PHP refuses to unserialize the value, and the widget renders empty or the whole panel disappears. A SQL UPDATE ... REPLACE() does exactly this.

WP-CLI’s search-replace understands serialized data and recalculates the lengths. That is the tool to use; the command reference documents the flags.

2. The indexing flag carried over

Staging sites are usually set to discourage search engines. In WordPress that is the blog_public option, and it lives in the database. Push the staging database and production inherits blog_public = 0 — the site is live, the content is there, and Google is told to stay away.

The symptom is quiet: no error, no broken page, just a noindex tag and a robots.txt that blocks everything. Google’s removal documentation explains the tags involved; the fix is one option update, but only if you know to look.

3. Stale object cache and transients

If the site uses Redis or Memcached, the object cache persists across the deployment. Cached options, widget output, and query results still point at the old domain or the old data.

Transients are worse because they can outlive a flush that only clears the page cache. A stale home value in a cached option produces redirect loops that look like a server problem.

4. Cron events that fire twice or not at all

The staging database carries scheduled events with timestamps. After the push, WordPress may run a backlog of “due” events at once — renewal reminders, failed-payment checks, newsletter sends.

On the staging side, the same events may have been firing for days against a copy of the customer list. That is why staging should have DISABLE_WP_CRON set to true and real cron disabled at the host.

5. Email sent from the wrong environment

A staging copy that can send mail will send mail. Password resets, order confirmations, and abandoned-cart emails go to real addresses with staging links in them.

Before any test that touches checkout or account flows, route staging mail to a trap — a Mailpit or MailHog instance, or an SMTP plugin pointed at a test inbox. The DNS and email setup guide covers the production side of that configuration.

Before the push: freeze and back up

Do these in order. Skipping the first one is how content written during the deployment disappears.

  1. Announce a freeze. No new posts, products, orders, or plugin updates on production until verification is done.
  2. Back up production completely. Database plus files, stored somewhere that is not the production server.
wp db export prod-backup-$(date +%F).sql
tar -czf prod-files-$(date +%F).tar.gz wp-content
  1. Back up staging too. If the push fails halfway, you want to return staging to a known state rather than rebuild it.
  2. Record the production versions. PHP, database, WordPress core, and the plugin list. A staging site on PHP 8.4 pushed to production on 8.1 is a deployment that fails on syntax, not on data.
wp core version
wp plugin list --status=active --format=table
php -v
  1. Confirm the URLs. Write down the exact staging and production origins, including https and any subdirectory. Every command below depends on getting these right.

The deployment sequence

Step 1: Put production in maintenance mode

Use a maintenance plugin or a server-level rule, not a static HTML file that you forget to remove. The coming soon and maintenance plugins guide covers the options and the trap of leaving maintenance mode on after launch.

Maintenance mode also stops customers from writing orders into a database that is about to be replaced.

Step 2: Export the staging database

wp db export staging-$(date +%F).sql --path=/path/to/staging

If the staging and production sites live on the same server with different table prefixes, export with the prefix intact and plan the import accordingly. Mixed prefixes are the most common reason a “simple” import lands in the wrong tables.

Step 3: Import into production

wp db import staging-$(date +%F).sql

If production has tables the staging dump does not — a separate analytics table, for example — the import leaves them alone unless you drop the database first. Dropping is cleaner and riskier; the backup from the previous section is what makes it acceptable.

Step 4: Rewrite the URL, dry run first

wp search-replace 'https://staging.example.com' 'https://example.com' \
  --all-tables \
  --precise \
  --skip-columns=guid \
  --report-changed-only \
  --dry-run

Read the report before removing --dry-run. You want to see the tables you expect and a plausible number of replacements.

Then run it for real:

wp search-replace 'https://staging.example.com' 'https://example.com' \
  --all-tables \
  --precise \
  --skip-columns=guid \
  --report-changed-only

Three flags deserve explanation:

  • --all-tables includes custom tables that do not use the WordPress prefix. Without it, WooCommerce lookup tables and plugin tables keep the old domain.
  • --precise uses PHP instead of SQL for the replacement, which is slower but handles serialized values correctly.
  • --skip-columns=guid protects the post GUID column. GUIDs are identifiers, not links; rewriting them breaks feed readers and never fixes a display problem. WordPress’s migration guide makes the same point.

If the prefixes differ between environments, use --all-tables-with-prefix instead and pass the staging prefix.

Step 5: Verify the stored URLs

wp option get home
wp option get siteurl

Both must return the production origin. If they return staging, the search-replace missed the options table — usually because the site uses constants in wp-config.php that override the database.

Step 6: Copy the files

Copy wp-content — themes, plugins, uploads, and generated CSS — excluding caches and backups:

rsync -av --delete \
  --exclude 'cache/' \
  --exclude 'uploads/cache/' \
  --exclude 'ai1wm-backups/' \
  --exclude '*.log' \
  /path/to/staging/wp-content/ /path/to/production/wp-content/

--delete makes production match staging, which is what you want for themes and plugins and what you do not want for user uploads created on production during the freeze. If the freeze was not absolute, copy uploads separately without --delete.

Do not copy wp-config.php. Production has its own database credentials, salts, and debug settings.

Step 7: Regenerate salts

wp config shuffle-salts

This invalidates every existing login cookie. Everyone — including you — logs in again. That is the correct behavior after a deployment: old sessions should not survive a database swap.

The wp-config reference documents the salt constants and the other settings worth reviewing at the same time.

Step 8: Clear every cache layer

wp cache flush
wp transient delete --all
wp rewrite flush --hard

Then, outside WP-CLI:

  • purge the page cache plugin,
  • purge the CDN,
  • restart PHP-FPM or reload OPcache if the host caches compiled files,
  • regenerate builder CSS if Elementor or a similar builder is active.

wp cache flush clears the object cache backend. It does not clear a page cache stored as files, and it does not touch a CDN. Those are separate layers, and each one can serve the old site after the database is correct.

Step 9: Reset cron

wp cron event list
wp cron event run --due-now

Run the due events once, deliberately, while you are watching. Do not let a backlog fire unattended during the first customer visit.

Then confirm production has real cron configured and DISABLE_WP_CRON is not left at true from a staging config.

Step 10: Turn indexing back on

wp option update blog_public 1

Check the result in the page source: no noindex meta tag, and a robots.txt that does not disallow everything. If the site uses an SEO plugin with its own indexing toggle, check that too — two switches control the same outcome.

Step 11: Set the environment type

In wp-config.php:

define( 'WP_ENVIRONMENT_TYPE', 'production' );

On staging, the same line reads 'staging'. WordPress 5.5 and later expose this through wp_get_environment_type(), and plugins use it to change behavior — debug bars, payment sandboxes, and email routing.

The constant does not control indexing by itself. blog_public does. Treating the environment constant as a noindex switch is a common and quiet mistake.

Verify before you remove maintenance mode

Work through this list on the production URL, logged out, in a private window:

CheckWhat you are looking for
Homepage200, correct domain in canonical
A deep page200, images and styles load
LoginWorks, redirects to production, not staging
SearchReturns results, no staging URLs
FormsSubmit and arrive at the right inbox
Cart and checkoutAdd, update quantity, reach payment
SitemapProduction URLs only
robots.txtNo site-wide disallow
404 pageReturns 404, not a 200 homepage
RedirectsOld URLs still 301 to the right place
Structured dataValidates, no staging URLs in markup

The redirect and structure checks matter more than they look. A deployment that changes the domain without preserving paths turns every old link into a 404, and the page structure guide explains why the hierarchy has to survive the move unchanged.

For a store, add one more: place a real test order with a test payment method and confirm it appears in the admin with the correct currency, tax, and shipping zone. The checkout and order processing guide lists the pieces that break independently of the deployment.

The WooCommerce exception

Pushing a staging database onto a live store replaces the orders, customers, and sessions that were created after the staging copy was taken. On a busy store that is data loss, not a deployment.

Three safer patterns:

  • Content-only deployment. Move theme and plugin files, then migrate only the posts, pages, and products that changed.
  • Replay the changes. Export the specific pages or products from staging and import them, rather than the whole database.
  • Schedule the window. If a full database push is unavoidable, do it during a freeze with no orders in flight, and reconcile any orders created between the copy and the push.

A migration plugin makes the first two easier. The migration plugin comparison covers what each one does with serialized data and custom tables, which is the part that decides whether the deployment is clean.

Rollback has to be a command, not a hope

Before the push you created two artifacts: a database dump and a files archive. The rollback is:

wp db import prod-backup-2026-11-30.sql
tar -xzf prod-files-2026-11-30.tar.gz -C /path/to/production
wp cache flush

Practice it on staging once. A backup you have never restored is a hypothesis, and the backup guidance is explicit that restore testing is part of the backup, not an optional extra.

Keep the staging site alive after the deployment. It is the rollback target if the production database is corrupted, and it is where the next change gets tested.

FAQ

Do I need a plugin to push staging to production?

No. WP-CLI covers the database, the URL rewrite, the cache, and the cron reset. A plugin is convenient when you want a button and a log, but the underlying steps are the same, and knowing them is what lets you diagnose a failed push.

Why does my site redirect to the staging domain after deployment?

Either the home or siteurl option still holds the staging URL, or wp-config.php defines WP_HOME and WP_SITEURL with the old value. Run wp option get home and wp option get siteurl, then check the config constants.

Why did my widgets disappear after the URL change?

The serialized data was replaced with a plain SQL query, so the byte counts no longer match and PHP cannot unserialize the values. Restore from the backup and re-run the replacement with wp search-replace, which recalculates the lengths.

Does staging need to be noindexed?

Yes, or it will compete with production in search results. Set blog_public to 0 on staging and back to 1 after the push. Also keep the staging site behind HTTP authentication if the host supports it.

How do I stop staging from emailing customers?

Disable WP-Cron on staging, route all mail through a trap or a test SMTP inbox, and never point staging at the production mail provider. The DNS guide covers the production configuration; staging should use a separate one.

Can I push staging to production without downtime?

A short maintenance window is the honest answer. A database swap cannot be done atomically while customers are writing orders, and the workarounds — content-only deployment or a blue-green setup — are more complex than most sites need. Plan a ten-minute window and verify inside it.

Share: tw in
Faraz Frank

About Faraz Frank

Author at WP Frank. Writing about WordPress development, design, and best practices.

View all posts by Faraz Frank →
edit_note

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.