Column 1
Skip to content
Column 1

How to Migrate WordPress with WP-CLI

How to Migrate WordPress with WP-CLI migration tutorial showing backup, transfer, verification, and DNS cutover checks

WP-CLI can move WordPress safely when it matches the source, destination, and risk level. This method is best for repeatable migrations, staging refreshes, domain changes, and scripted validation on servers with shell access.

Audience: developers, sysadmins, agencies, and hosts comfortable with command-line WordPress maintenance. Before using this path, decide whether the move changes hosts, domains, DNS, email, PHP versions, database versions, cache layers, or business data. Those details matter more than the migration button itself.

Before migration

  • Confirm shell access and WP-CLI availability on both environments.
  • Back up files and database first.
  • Know the old and new URLs, paths, and database credentials.
  • Use maintenance mode or a content freeze for busy production sites.

Migration steps

  1. Export the source database with WP-CLI or the host backup tool.
  2. Copy WordPress files to the destination using a safe transfer method.
  3. Create or prepare the destination database.
  4. Import the database on the destination.
  5. Run a safe WP-CLI search-replace for the new URL when needed.
  6. Flush cache, regenerate permalinks, and validate.

Post-migration verification

Use browser checks plus WP-CLI checks for options, users, plugins, cron events, and database tables. Test front-end, wp-admin, uploads, forms, checkout, and logs.

Also check server logs, PHP errors, WordPress Site Health, cache behavior, CDN routing, redirects, robots/indexing state, cron jobs, and whether a new backup job exists on the destination.

Migration risks

  • Search-replace must preserve serialized data.
  • Wrong path or database target can damage production.
  • Commands should not expose private credentials in logs or shell history.

Rollback and cutover planning

Keep the old site online until the new site is proven. For stores, memberships, bookings, LMS sites, directories, and lead-generation sites, plan a final data freeze or sync so records do not split between servers. Keep DNS rollback notes, old-host access, and a verified backup until traffic and logs are stable.

Fix I.T. Phill recommendation

Use WP-CLI when it gives you the cleanest preview and rollback path. If the site makes money or stores customer records, treat the final cutover as a maintenance window, not a casual copy job.

Related Fix I.T. Phill Guides

Sources Checked

2026 SEO Refresh: WP-CLI WordPress Migration Checklist

Admin action path: Use WP-CLI migration when you can repeat the export, import, and URL-change process and preserve a rollback path.

What to verify before changing production

  • Take a file and database backup before changing URLs or DNS.
  • Record the exact migration method and rollback path.
  • Verify wp-admin, public pages, media, permalinks, SSL, forms, email, REST, sitemap, and cache after launch.

Source-backed references and next reads

Ticket evidence should include the method used, backup timestamp, destination URL, DNS or SSL state, mail-delivery result where relevant, and the public verification steps completed after the change.