Documentation

WP-CLI Command – Find & Replace Subcommand

wp migratedb find-replace 
  [--find=<strings>] 
  [--replace=<strings>] 
  [--regex-find=<strings>]
  [--regex-replace=<strings>] 
  [--case-sensitive-find=<strings>]
  [--case-sensitive-replace=<strings>]
  [--include-tables=<tables>] 
  [--exclude-post-types=<post-types>] 
  [--skip-replace-guids] 
  [--exclude-spam] 
  [--include-transients] 
  [--subsite=<blog-id|subsite-url>]

Run a find & replace on the database.

Options

[--find=<strings>]
  A comma separated list of strings to find when performing a string find
  & replace across the database.

  Table names should be quoted as needed, i.e. when using a comma in the
  find/replace string.

  The --replace=<strings> argument should be used in conjunction to specify
  the replace values for the strings found using this argument. The number
  of strings specified in this argument should match the number passed into
  --replace=<strings> argument.

[--replace=<strings>]
  A comma separated list of replace value strings to implement when
  performing a string find & replace across the database.

  Should be used in conjunction with the --find=<strings> argument, see it's
  documentation for further explanation of the find & replace functionality.

[--regex-find=<strings>]
  A comma separated list of regex pattern strings to match against when performing
  a regex find and replace across the database.

[--regex-replace=<strings>]
  A comma separated list of replace value strings to implement when
  performing a regex find & replace across the database. 

  Should be used in conjunction with the --regex-find=<strings> argument.

  A replace string may contain references of the form \n or $n, with the latter
  form being the preferred one. Every such reference will be replaced by the text 
  captured by the n'th parenthesized pattern used in the --regex-find pattern.

[--case-sensitive-find=<strings>]
  A comma separated list of strings to find when performing a case-sensitive string 
  find and replace across the database.

[--case-sensitive-replace=<strings>]
  A comma separated list of replace value strings to implement when
  performing a case-sensitive string find & replace across the database.

[--exclude-post-revisions]
  Exclude post revisions from the find & replace. Available only in WP Migrate DB.

[--skip-replace-guids]
  Do not perform a find & replace on the guid column in the wp_posts table.

[--exclude-spam]
  Exclude spam comments from the find & replace.

[--include-transients]
  Include transients (temporary cached data) in the find & replace.

WP Migrate DB Pro Options

When running WP Migrate DB Pro the following option replaces the --exclude-post-revisions option in WP Migrate DB.

[--exclude-post-types=<post-types>]
  A comma separated list of post types to exclude. Excluding this parameter
  will run the find & replace on all post types.

The following option is only available in WP Migrate DB Pro.

[--include-tables=<tables>]
  The comma separated list of tables to search. Excluding this parameter
  will perform a find & replace on all tables in your database that begin with your
  installation's table prefix, e.g. wp_.

Multisite Tools Addon Options

When the Multisite Tools addon is installed and activated, you also have the following option.

[--subsite=<blog-id|subsite-url>]
  In a multisite setup, run the find & replace on the tables of a specific subsite