Database Search and Replace Script in PHP

Search Replace DB version 3.0.0 (currently a BETA version) allows you to carry out database wide search/replace actions that don’t damage PHP serialized strings or objects with a user friendly interface and experience.

Installation & Use

search-replace-mobile-screenshot Now acts like a web app!

To use the script, download the zip file from below, extract the folder called secret-name-please, renaming it to something secret of your choosing, then navigate to that folder in your browser. The script will automatically attempt to find and populate the database field but you must check that the details are correct and that it is for the database you wish to carry out a search/replace operation on.

To see how you can use this tool to aid migrations, check out our article on WordPress migrations or visit the WP Tuts+ article that mentions this script.

If you are in any doubt whatsoever about how to use this standalone script, then please consider getting an expert in.  It’s a really powerful bit of code that if used badly can damage a WP install beyond repair.  If you want help, get in somebody like us, for example, or any of the other great guys listed over at CodePoet.

IMPORTANT: This code is supplied with no warranty or support implied. You use it entirely at your own risk. The code is licensed under the GPL V3 and you should be aware of its limitations and how they affect you and your use of this code. Please also read the instructions and warnings provided and always take a verified backup of your database before starting.

Download v 3.0.0 BETA

Problems? Try v 2.1.0 STABLE


* Version 3.0.0:
* Major overhaul
* * Multibyte string replacements
* * UI completely redesigned
* * Removed all links from script until ‘delete’ has been clicked to avoid
* security risk from our access logs
* * Search replace functionality moved to it’s own separate class
* * Replacements done table by table to avoid timeouts
* * Convert tables to InnoDB
* * Convert tables to utf8_unicode_ci
* * Use PDO if available
* * Preview/view changes
* * Optionally use preg_replace()
* * Scripts bootstraps WordPress/Drupal to avoid issues with unknown
* serialised objects/classes
* * Added marketing stuff to deleted screen (sorry but we’re running a
* business!)
* Version 2.2.0 (never formally released but patched into v3.0.0):
* * Added remove script patch from David Anderson (
* * Added ability to replace strings with nothing
* * Copy changes
* * Added code to recursive_unserialize_replace to deal with objects not
* just arrays. This was submitted by Tina Matter.
* ToDo: Test object handling. Not sure how it will cope with object in the
* db created with classes that don’t exist in anything but the base PHP.
* For changes prior to v2.2.0 please refer to index.php where you will find a complete changelog. You can also browse the project on github.

To Be Done

Ensure UTF8 encoding is enforced (see comments). Added in v2.1.0
Self deletion or security system to prevent accidental security risks. Added in v3.0.0
Release CLI version for use on non-WP sites, or for other purposes (already supports use on any MySQL DB.) Added in v3.0.0
Change to GPL V3. Added in v3.0.0
Eliminate warnings and remove deprecated function calls. Added in v2.1.0
Add facility to subscribe to interconnect/it Newsletter. Added in v3.0.0
Confirm deletion has actually happened.
Add old versions for download to this page.


We’d love to get contributions, bug reports and more on the Search Replace DB public github repository. Please come on over – you’ll be more than welcome!


We’ve been asked a lot in the comments box below about accepting donations. But you can’t believe what a headache that is from an accounting and tax perspective.

Consequently all we can say is that if you wish to you can buy a personal gift for the key developers from one of the wishlists below – especially given that it’s a spare time project. If others who have contributed wish to provide us their wishlist links then we’d be more than happy to add them.

David Coveney is the project lead.
James Whitehead added the nice UI in v2.0+.
Robert O’Rourke created version 3.0.0 with its AJAX UI and massive improvements.

  • Robbie Ferguson 24 / Apr / 2014 at 4:25 pm

    This thing is AWESOME. I moved a site outside of the development folder only to realize all the image refs were now broken. You saved me a ton of time and boredom. Thank you!

  • Santosh Joshi 19 / Apr / 2014 at 4:37 am

    You guys are real savior. I used 3.0 Beta and it completed job very awesomely.

  • Daphatmac 16 / Apr / 2014 at 10:36 am

    OMG, you have no idea how much time and effort you’ve saved me – YOU LEGEND!!!!


  • Soury 15 / Apr / 2014 at 9:23 pm

    Great script. Absolutely easy to use and very efficient. Great great great job!

  • Eugine 15 / Apr / 2014 at 2:22 pm

    I love your script and use every wordpress project and I introduced how to use it in my books. Sometimes people say there is error saying “could not find driver”. I can’t figure out what makes the error since I have not experienced such error before. Could you tell me why that happens and how to fix it?

  • […] rapide de procéder à une migration WordPress (pour sa mise en ligne) et je suis tombé sur l’outil d’Interconnect IT. D’abord, sceptique quant à l’utilisation d’un script tiers pour réaliser une mise en ligne […]

  • Alan Blount 12 / Apr / 2014 at 6:22 am

    loved it – a very convenient tool, and excellent interface and data presentation.

  • sajin tm 11 / Apr / 2014 at 7:39 am

    Hi ,
    A nice script and useful one. the way it auto detected the settings surprised me :).
    my question is , if it possible to create as an addon ,
    and can we run the addon in the old website ? so we can add a feature to download the updated database results which is having the new domains url.


1 34 35 36