Command builder
Build a safe wp search-replace
Generate the command for a domain move or string swap — then preview it with --dry-run before you commit anything.
Generated command
What the options do
--dry-run- Reports how many replacements would happen, without changing the database. Always run this first.
- Which tables
- Registered tables (default) covers WordPress's own tables — right for most domain moves. With the WP prefix also includes custom/plugin tables that share your prefix. All tables touches every table in the database regardless of prefix — only when you know why (e.g. multiple installs in one DB). Specific tables lets you name exact tables. The prefix itself is read from
wp-config.phpautomatically, so there's no prefix to type. --skip-columns- Columns to leave untouched.
guidis the classic one — a post's GUID is a permanent identifier and must never be rewritten, even during a domain move. --recurse-objects- WordPress stores serialized PHP arrays/objects (widget and plugin settings) in the database; this replaces safely inside them instead of corrupting the length-prefixed data. WP-CLI enables it by default — only tick the box if you want the flag stated explicitly.
--precise- Forces PHP (instead of the faster MySQL path) for replacement — more thorough with serialized data, but slower on big databases.
--network- Multisite only. Runs across every site in the network (
wp_2_*,wp_3_*, …) rather than just the current site. The Multisite URL field instead targets one specific site. --allow-root- WP-CLI refuses to run as the Unix
rootuser by default (a safety guard). This overrides it — handy when you're SSH'd in as root.
Common WordPress tables: wp_posts, wp_postmeta, wp_options, wp_users, wp_usermeta, wp_comments, wp_commentmeta, wp_terms, wp_term_taxonomy, wp_term_relationships.
Sources & references
- wp search-replace — command referenceWordPress Developer
- WP-CLI handbookWordPress.org
- Moving WordPress (database URLs & serialized data)WordPress Developer