diff --git a/README.md b/README.md index bcd6d4b0..082c9653 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,8 @@ the Key column. [--new=] An alternative way to specify the replacement string. Use this when the - replacement string starts with '--' (e.g., --new='--other-text'). + replacement string starts with '--' (e.g., --new='--other-text') or is + empty. [--dry-run] Run the entire search/replace operation and show report, but don't save @@ -158,6 +159,9 @@ the Key column. # Search/replace string containing hyphens $ wp search-replace --old='--old-string' --new='new-string' + # Remove a string by replacing it with an empty value + $ wp search-replace --old='remove-me' --new='' + # Use precise mode for complex serialized data $ wp search-replace 'oldurl.com' 'newurl.com' --precise diff --git a/src/Search_Replace_Command.php b/src/Search_Replace_Command.php index 8423560d..cae8e86c 100644 --- a/src/Search_Replace_Command.php +++ b/src/Search_Replace_Command.php @@ -162,7 +162,8 @@ class Search_Replace_Command extends WP_CLI_Command { * * [--new=] * : An alternative way to specify the replacement string. Use this when the - * replacement string starts with '--' (e.g., --new='--other-text'). + * replacement string starts with '--' (e.g., --new='--other-text') or is + * empty. * * [--dry-run] * : Run the entire search/replace operation and show report, but don't save @@ -275,6 +276,9 @@ class Search_Replace_Command extends WP_CLI_Command { * # Search/replace string containing hyphens * $ wp search-replace --old='--old-string' --new='new-string' * + * # Remove a string by replacing it with an empty value + * $ wp search-replace --old='remove-me' --new='' + * * # Use precise mode for complex serialized data * $ wp search-replace 'oldurl.com' 'newurl.com' --precise *