Skip to content
Merlin Tools

URL migration generator

The right WP-CLI command to change domain, without breaking serialized data.

Genuinely free. No sign-up, no email, no limits, no cookies. We don't store the URL you analyse.

Only if your site doesn't use the default wp_ prefix.

Code
wp search-replace 'https://old-domain.com' 'https://new-domain.com' --all-tables --precise --dry-run

# Review the preview above, then remove --dry-run to apply for real.
# Always back up the database first: wp db export backup-before-migration.sql
# --precise forces PHP-based (not SQL) replacement, which matters for serialized and multibyte data.

What it's for

Changing domain or moving from staging to production means replacing the old URL across the whole database, but many WordPress tables hold PHP-serialized data (widgets, ACF fields, theme options): a raw UPDATE corrupts them. WP-CLI's wp search-replace handles serialization correctly. This tool generates the ready-to-run command, with --dry-run on by default.

← All WordPress tools

Frequently asked questions

Why don't you generate a raw SQL query instead?

Because a raw UPDATE on columns holding PHP-serialized data (arrays, objects) changes the length of the replaced strings without updating the length counters written into the serialization: the result is widgets, ACF fields or theme options that silently stop working. wp search-replace avoids this because it deserializes, replaces and re-serializes correctly. If you don't have WP-CLI access, use a dedicated plugin such as Better Search Replace instead of a manual query.

Should I run the generated command right away?

No: the command includes --dry-run, which previews the replacements without applying them. Check it, back up the database, then rerun the command without --dry-run.