Plugin: Database Search & Replace

Plugin: Database Search & Replace

Extremly detailed article on manually searching and replacing.

Search-replace from command line

If you can install WP-CLI, superior way is to use WP-CLI search-replace command.

I have used a PHP CLI script called Search-Replace-DB and I am quite satisfied. Read about it here.

This is how you install it

cd /var/www/vhosts/hostingtipp.ch
wget https://github.com/interconnectit/Search-Replace-DB/archive/master.zip
unzip master.zip && rm master.zip && mv Search-Replace-DB-master srdb
chmod a+x srdb/srdb.cli.php

And use it with

cd /var/www/vhosts/hostingtipp.ch
srdb/srdb.cli.php --dry-run -h localhost -u hostingtipp-ch -p "S06d7#mw" -n hostingtipp-ch -s "http://www.hostingtipp.ch/wp-content/" -r "/wp-content/"

Search-replace with a plugin

Sometimes I need to do a lot of replacement, so a nicer way is needed - as a Wordpress plugin. So decided to do a research on this.

The same Search-Replace-DB script is converted to a plugin and is found under the name Better Search Replace. Read more details about it here.

Also very flexible is Search Regex, but it doesn’t search in wp_options table and probably not in any unknown plugin table, because it does not support serialized data.

Note: This is almost perfect plugin. Just read more here

The most famous one is Search and Replace but it’s incredible how shitty it is.

date 17. Aug 2016 | modified 24. Jun 2022
filename: Plugins » DB Search & Replace