From 15945137e39904722abeb404220775535c91855a Mon Sep 17 00:00:00 2001 From: Benjamin Zekavica Date: Thu, 13 Jun 2024 11:05:29 +0200 Subject: [PATCH 1/2] added search and replace quick start & adding new command --- quick-start.md | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/quick-start.md b/quick-start.md index fe53de922..370129266 100644 --- a/quick-start.md +++ b/quick-start.md @@ -126,3 +126,49 @@ Success: Finished regenerating the image. ``` Wondering what's next? Browse through [all of WP-CLI's commands](https://developer.wordpress.org/cli/commands/) to explore your new world. Or, catch up with [shell friends](https://make.wordpress.org/cli/handbook/shell-friends/) to learn about helpful command line utilities. + + +**Search and Replace Links** + +1. Navigate to Your WordPress Project: + Open a terminal and navigate to the root directory of your WordPress project. + +2. Preview Changes (Optional) + To see which links will be replaced in your database, use the --dry-run flag: +```bash + wp search-replace 'http://oldsite.com' 'http://newsite.com' --dry-run +``` + +3. Replace Links: + When ready to replace the links, run: + +```bash + wp search-replace 'http://oldsite.com' 'http://newsite.com' +``` + +**Adding New Commands** + +1. Navigate to Your WordPress Project: + Open a terminal and navigate to the root directory of your WordPress project. + +2. Create or Open `wp-cli.yml`:** + Use a text editor to create or open the `wp-cli.yml` configuration file: + + ```bash + nano wp-cli.yml + ``` + +3. Add Custom Commands: + Inside the `wp-cli.yml` file, under the `commands` section, add your custom commands. For example: + + ```yaml + commands: + yournewcommand: + run: + - plugin activate my-plugin + - theme activate my-theme + ``` + +4. Save and exit the editor. + +For more detailed information about WP-CLI commands, visit the [WP-CLI Commands Cookbook](https://make.wordpress.org/cli/handbook/guides/commands-cookbook/). \ No newline at end of file From f74dec99ffff02194153bcc86b40929c6585b507 Mon Sep 17 00:00:00 2001 From: Daniel Bachhuber Date: Thu, 13 Jun 2024 11:40:34 +0200 Subject: [PATCH 2/2] Edit `wp search-replace` example to fit others; remove custom command --- quick-start.md | 48 +++++++++--------------------------------------- 1 file changed, 9 insertions(+), 39 deletions(-) diff --git a/quick-start.md b/quick-start.md index 370129266..30fd068cc 100644 --- a/quick-start.md +++ b/quick-start.md @@ -125,50 +125,20 @@ Found 1 image to regenerate. Success: Finished regenerating the image. ``` -Wondering what's next? Browse through [all of WP-CLI's commands](https://developer.wordpress.org/cli/commands/) to explore your new world. Or, catch up with [shell friends](https://make.wordpress.org/cli/handbook/shell-friends/) to learn about helpful command line utilities. +**Search and replace URLs** +If you're moving a database from one domain to another, `wp search-replace` ([doc](https://developer.wordpress.org/cli/commands/search-replace/)) makes it easy to update all URL references in your database. -**Search and Replace Links** +To see which links will be replaced in your database, use the --dry-run flag: -1. Navigate to Your WordPress Project: - Open a terminal and navigate to the root directory of your WordPress project. - -2. Preview Changes (Optional) - To see which links will be replaced in your database, use the --dry-run flag: -```bash - wp search-replace 'http://oldsite.com' 'http://newsite.com' --dry-run ``` - -3. Replace Links: - When ready to replace the links, run: - -```bash - wp search-replace 'http://oldsite.com' 'http://newsite.com' +wp search-replace 'http://oldsite.com' 'http://newsite.com' --dry-run ``` -**Adding New Commands** - -1. Navigate to Your WordPress Project: - Open a terminal and navigate to the root directory of your WordPress project. - -2. Create or Open `wp-cli.yml`:** - Use a text editor to create or open the `wp-cli.yml` configuration file: +When ready to replace the links, run: - ```bash - nano wp-cli.yml - ``` - -3. Add Custom Commands: - Inside the `wp-cli.yml` file, under the `commands` section, add your custom commands. For example: - - ```yaml - commands: - yournewcommand: - run: - - plugin activate my-plugin - - theme activate my-theme - ``` - -4. Save and exit the editor. +``` +wp search-replace 'http://oldsite.com' 'http://newsite.com' +``` -For more detailed information about WP-CLI commands, visit the [WP-CLI Commands Cookbook](https://make.wordpress.org/cli/handbook/guides/commands-cookbook/). \ No newline at end of file +Wondering what's next? Browse through [all of WP-CLI's commands](https://developer.wordpress.org/cli/commands/) to explore your new world. For more detailed information about creating custom commands, visit the [WP-CLI Commands Cookbook](https://make.wordpress.org/cli/handbook/guides/commands-cookbook/). Or, catch up with [shell friends](https://make.wordpress.org/cli/handbook/shell-friends/) to learn about helpful command line utilities.