The database has no Undo. So every database block starts with an export.
The classic trap: an AI assistant suggests one quick SQL query to change the domain. You press Enter. Plugin settings are a serialized array: s:24 says the string is 24 characters, but the new URL has 31. unserialize() fails, WordPress sees false. Settings gone. No error.
The right block:
- wp db export before-migration.sql
- wp search-replace ‘http://old.test’ ‘https://new-domain.com’ –dry-run
- Read it. Type PHP = serialized data, lengths get recounted.
- wp search-replace ‘http://old.test’ ‘https://new-domain.com’
- Something wrong? wp db import before-migration.sql
AI can type the command. Only you press Enter.
Practice Cases: real workflows built with WP-CLI commands. We built a WP-CLI practice terminal. Break nothing.
Go deeper
- Full guide: 4wp.dev/wp-cli