Forrest logo
back to the wp tool

wordpress:cli:database:replace

Replace all instances of a string in the database.
$ wp search-replace ${old_string} ${new_string}
try on your machine

This is a command used in the WordPress Command Line Interface (CLI) to replace a specific string of text with a new one across your entire WordPress database. The ${old_string} represents the text you want to replace and the ${new_string} represents the new text you want to use. For example, if you wanted to change all instances of the word "hello" to "bonjour" in your WordPress database, you would use the command like this: wp search-replace "hello" "bonjour" This command is very useful when you need to rename a website or change a certain configuration that is used across your WordPress website. It helps you replace all occurrences of the old string with the new one quickly and easily.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the wp tool