Safe Search Replace
This developer/sysadmin tool helps solve the problem of doing a search and replace on a WordPress site when doing a migration to a domain name with a different length.
WARNING! Take a backup first, and carefully test the results of this code. If you don't, and you vape your data then you only have yourself to blame. Seriously. And if you're English is bad and you don't fully understand the instructions then STOP. Right there. Yes. Before you do any damage.
Use Of This Script Is Entirely At Your Own Risk
We accept no liability from the use of this tool.
If you're not comfortable with this kind of stuff, get an expert, like us, to do this work for you. You do this ENTIRELY AT YOUR OWN RISK! We accept no responsibility if you mess up your data. There is NO UNDO here!
The easiest way to use it is to copy your site's files and DB to the new location. You then, if required, fix up your .htaccess and wp-config.php appropriately. Once done, run this script, select your tables (in most cases all of them) and then enter the search replace strings. You can press back in your browser to do this several times, as may be required in some cases.
Of course, you can use the script in many other ways - for example, finding all references to a company name and changing it when a rebrand comes along. Or perhaps you changed your name. Whatever you want to search and replace the code will help.
Don't Forget to Remove Me!
Delete this utility from your server after use. It represents a major security threat to your database if maliciously used.