↑ ↓ select, Enter open, Esc close

Test search and replace in the database

Adjust the values, the command updates live
user@server
wp search-replace 'http://example.com' 'https://example.com' --all-tables --dry-run --report-changed-only --path=/var/www/vhosts/example.com/httpdocs

Runs search and replace as a simulation only and lists the number of matches per table and column. Serialized data is handled correctly. Worthwhile before every real run to catch typos and unexpectedly high match counts.

Note: --all-tables also covers tables without the WordPress prefix in the same database. Without that option, only registered WordPress tables are searched.

Also searched as

  • wp search replace dry run
  • test what search-replace changes
  • find url in wordpress database

Related one-liners

All in WP-CLI

Read first, then run.

The commands on myline.de act directly on servers, files and databases. A wrong path or placeholder can delete data irreversibly or make a server unreachable.

  • All commands are provided without warranty and are not tested on every system.
  • Understand what a command does before running it, and check every placeholder.
  • Make a backup first and, if possible, try it on a test system.
  • You run commands at your own risk. Liability for damages is excluded to the extent permitted by law.