TIL, that if you run wp search-replace old@email.com new@email.com
it won’t actually change all instances in your database. In my case it specifically didn’t change the Gravity Forms notification email to new@email.com
.
When Gravity Forms creates it’s tables using the {$wpdb-prefx}_rg_{table_name}
format it doesn’t also register those tables with the $wpdb
database object thus WordPress doesn’t know about the tables and then wp search-replace
won’t find the entries.
To get wp search-replace
to search and replace all instances in all tables even if it doesn’t officially know about them use the --all-tables-with-prefix
argument.
wp search-replace old@email.com new@email.com --all-tables-with-prefix
This could introduce another issue though, if you have a user with old@email.com
as their username it will also be change to new@email.com
so to skip all user tables use the command below.
wp search-replace old@email.com new@email.com --all-tables-with-prefix --skip-tables=wp_user*
Always make sure that you use the --dry-run
flag first to make it do the search without the replace so you have some idea what’s happening.
You can find the documentation here for wp search-replace
.
It’s also worth remembering that the search and replace is case sensitive. Today I had an email that was spelled in camelCase old@emailDomain.com
which did not get changed when I searched old@emaildomain.com
.