diff --git a/README.md b/README.md index bcd6d4b0..247cadbf 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,9 @@ multisite, this will just be the tables for the current site unless Search/replace intelligently handles PHP serialized data, and does not change primary key values. +In non-regex mode, it also replaces JSON-escaped versions of the search +string, such as `http:\/\/example.com` when searching for +`http://example.com`. Tables without a primary key are skipped. To check whether a table has a primary key, run `wp db query 'DESCRIBE '` and look for 'PRI' in @@ -161,6 +164,9 @@ the Key column. # Use precise mode for complex serialized data $ wp search-replace 'oldurl.com' 'newurl.com' --precise + # Replace a URL in plain text and JSON-escaped data + $ wp search-replace 'https://example.com' 'https://example.test' + # Bash script: Search/replace production to development url (multisite compatible) #!/bin/bash if $(wp --url=http://example.com core is-installed --network); then diff --git a/src/Search_Replace_Command.php b/src/Search_Replace_Command.php index 8423560d..a7dc1fbe 100644 --- a/src/Search_Replace_Command.php +++ b/src/Search_Replace_Command.php @@ -139,6 +139,9 @@ class Search_Replace_Command extends WP_CLI_Command { * * Search/replace intelligently handles PHP serialized data, and does not * change primary key values. + * In non-regex mode, it also replaces JSON-escaped versions of the search + * string, such as `http:\/\/example.com` when searching for + * `http://example.com`. * * Tables without a primary key are skipped. To check whether a table has a * primary key, run `wp db query 'DESCRIBE
'` and look for 'PRI' in @@ -278,6 +281,9 @@ class Search_Replace_Command extends WP_CLI_Command { * # Use precise mode for complex serialized data * $ wp search-replace 'oldurl.com' 'newurl.com' --precise * + * # Replace a URL in plain text and JSON-escaped data + * $ wp search-replace 'https://example.com' 'https://example.test' + * * # Bash script: Search/replace production to development url (multisite compatible) * #!/bin/bash * if $(wp --url=http://example.com core is-installed --network); then