File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -45,7 +45,8 @@ the Key column.
4545
4646 [--new=<value>]
4747 An alternative way to specify the replacement string. Use this when the
48- replacement string starts with '--' (e.g., --new='--other-text').
48+ replacement string starts with '--' (e.g., --new='--other-text') or is
49+ empty.
4950
5051 [--dry-run]
5152 Run the entire search/replace operation and show report, but don't save
@@ -158,6 +159,9 @@ the Key column.
158159 # Search/replace string containing hyphens
159160 $ wp search-replace --old='--old-string' --new='new-string'
160161
162+ # Remove a string by replacing it with an empty value
163+ $ wp search-replace --old='remove-me' --new=''
164+
161165 # Use precise mode for complex serialized data
162166 $ wp search-replace 'oldurl.com' 'newurl.com' --precise
163167
Original file line number Diff line number Diff line change @@ -162,7 +162,8 @@ class Search_Replace_Command extends WP_CLI_Command {
162162 *
163163 * [--new=<value>]
164164 * : An alternative way to specify the replacement string. Use this when the
165- * replacement string starts with '--' (e.g., --new='--other-text').
165+ * replacement string starts with '--' (e.g., --new='--other-text') or is
166+ * empty.
166167 *
167168 * [--dry-run]
168169 * : 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 {
275276 * # Search/replace string containing hyphens
276277 * $ wp search-replace --old='--old-string' --new='new-string'
277278 *
279+ * # Remove a string by replacing it with an empty value
280+ * $ wp search-replace --old='remove-me' --new=''
281+ *
278282 * # Use precise mode for complex serialized data
279283 * $ wp search-replace 'oldurl.com' 'newurl.com' --precise
280284 *
You can’t perform that action at this time.
0 commit comments