# Preview Serialized WordPress Replacements With WP-CLI

https://ferkesh.net/uk/baza-znan/stattia/wordpress-wp-cli-serialized-search-replace-dry-run

Plain text replacement can damage stored PHP serialization when a string changes length. WP-CLI search-replace understands serialized data and supports a report-only dry run. Use it to decide what an approved change would touch.

![Workflow. Confirm site and tables. Dry run only. Review per-table counts. Record approved scope.](https://ferkesh.net/kb-media/ferkesh-guide-diagrams-batch-14b.svg#wordpress-wp-cli-serialized-search-replace-dry-run)

## Confirm the installation and the intended scope

Check the WP-CLI path, site URL and table list against an isolated staging copy. On Multisite, confirm the target subsite and intended table set. Decide which plugin tables and columns should participate and preserve the GUID column when replacing ordinary site URLs.

## Run the dry run with reserved domains

For a synthetic example, use wp search-replace 'https://old.example' 'https://new.example' wp_options wp_postmeta --skip-columns=guid --dry-run --report-changed-only. Replace wp_options and wp_postmeta with the actual approved staging table names. Include one fixture with a URL in a serialized setting, then compare the reported replacement counts and tables with your expectation.

## Reconcile surprising counts

A zero can indicate the wrong table, site or URL form. A large unexpected count can indicate an overbroad match. Inspect sanitized fixtures or applicable configuration in the editor. Avoid verbose logs containing actual settings or personal values. If the preview is sound, preserve it with a fresh backup and obtain the appropriate operational approval for the real change.

## Expected result

The dry run identifies the intended tables and counts while leaving the database unchanged. Document exact scope and verification before a write is ever scheduled.

## Related guides

- [Confirm the WordPress Site Before Running WP-CLI](https://ferkesh.net/knowledgebase/article/wp-cli-confirm-site-before-command)
- [How to Change the Domain of an Existing WordPress Site](https://ferkesh.net/knowledgebase/article/wordpress-change-site-domain)

## Official references

- [WP-CLI search-replace options and serialization](https://developer.wordpress.org/cli/commands/search-replace/)

Ferkesh Hosting. Last reviewed November 27, 2026.
