WordPress Serialized PHP Search and Replace Script

Yesterday I came across a very handy PHP script for migrating WordPress between domains. When doing a search and replace you must use a safe search and replace method that preserves the integrity of the serialized string lengths. If you were just do to a normal search and replace on the database you would run into problems such as losing widget settings. This is because the length of the string changes, but the indexes for the serialized strings doesn’t.

No problem now though, using this script!

Simply visit the interconnect/it website and download the Search Replace DB script then upload it to your server and run it by visiting the URL, http://yourwebsite.com/nameofscript.php. There is instructions on the screen as you run through it.


This code is supplied with no warranty or support implied. You use it entirely at your own risk. Currently it is supplied under the WTFPL but this will change to the GPL eventually. And when you’ve finished using the script, PLEASE delete it as it can pose a serious security risk to your site.

Email Newsletter

Enjoy reading here? Why not subscribe and get my very occasional newsletter sent right to you. It's great and stuff.

Speak Your Mind


  • 2

    Coffees brewed today

  • 7

    Items on todays agenda

  • 18

    Emails composed today