When moving your WordPress site to a new domain or server, you will likely run into a need to run a search/replace on the database for everything to work correctly. Fortunately, there are several plugins available for this task, however, all have a different approach to a few key features. This plugin consolidates the best features from these plugins, incorporating the following features in one simple plugin:
- Serialization support for all tables
- The ability to select specific tables
- The ability to run a „dry run“ to see how many fields will be updated
- No server requirements aside from a running installation of WordPress
- WordPress Multisite support
Time-saving features available in the Pro version:
- View exactly what changed during a search/replace
- Backup and import the database while running a search/replace
- Priority email support from the developer of the plugin
- Save or load custom profiles for quickly repeating a search/replace in the future
- Support and updates for 1 year
The search and replace functionality is heavily based on interconnect/it’s great and open-source Search Replace DB script, modified to use WordPress native database functions to ensure compatibility.
Want to contribute?
Feel free to open an issue or submit a pull request on GitHub.
Install Better Search Replace like you would install any other WordPress plugin.
- Login to your WordPress admin and go to Plugins -> Add New
- Type „Better Search Replace“ in the search bar and select this plugin
- Click „Install“, and then „Activate Plugin“
- Unzip the plugin and upload the „better-search-replace“ folder to your ‘wp-content/plugins’ directory
- Activate the plugin through the Plugins menu in WordPress
- Using Better Search Replace
Once activated, Better Search Replace will add a page under the „Tools“ menu page in your WordPress admin.
- Is my host supported?
Yes! This plugin should be compatible with any host.
- Can I damage my site with this plugin?
Yes! Entering a wrong search or replace string could damage your database. Because of this, it is always adviseable to have a backup of your database before using this plugin.
- How does this work on WordPress Multisite?
When running this plugin on a WordPress Multisite installation, it will only be loaded and visible for Network admins. Network admins can go to the dashboard of any subsite to run a search/replace on just the tables for that subsite, or go to the dashboard of the main/base site to run a search/replace on all tables.
- How can I use this plugin when changing URLs?
If you’re moving your site from one server to another and changing the URL of your WordPress installation, the approach below allows you to do so easily without affecting the old site:
- Backup the database on your current site
- Install the database on your new host
- On the new host, define the new site URL in the
wp-config.phpfile, as shown here
- Log in at your new admin URL and run Better Search Replace on the old site URL for the new site URL
- Delete the site_url constant you added to
wp-config.php. You may also need to regenerate your .htaccess by going to Settings -> Permalinks and saving the settings.
More information on moving WordPress can be found here.
This Plugin is really awesome !
I switched from a new domain name within one hour 🙂
I replaced all old domain database references by the new one in a few clicks, thank you very much !
This was recommended from my hosting company WP Engine… I was a little nervous to install anything that changes file names, but I had a ton of links to update. I moved my multisite live to the new domain, I started manually checking the site and updating links… Then I reached out to my hosting company because I was sure there was a better way. They suggested Better Search and Replace. I backed up the site, ran the script to remove the hosting company domain and push everything to the live domain and voila! It made 373 changes and took about 2.5 minutes. This plugin is a MUST have for everyone developing on sub domains! I would give it 10 stars out of 5!
Perfectly what you need. No more to wish.
The „Search & Replace“ plugin (as opposed to this plugin, called „Better Search & Replace), is actually better than „Better Search & replace“ because it gives you a detailed report of what details were updated in the database.
This plugin makes you pay for showing such detail. It only tells you that „x number of cells were updated“. It doesn’t show you anything more, which makes it pretty useless if you want to see what actually happened.
Recommended by bluehost to use this plugin when transferring to a new domain name. Saved me from having to manually swap hundreds of domain names in the database.
I recently moved a site to SSL and the image links had not been updated. This plugin was easy to use. There is a ‘dry run’ to see what changes it will make. Also, next to each option there is a small question mark that you can click for more information. I made a database backup before starting. Including the backup, it took about 5 minutes.
Contributors & Developers
“Better Search Replace” is open source software. The following people have contributed to this plugin.Contributors
Interested in development?
1.3 – November 10, 2016
- Improvement: Updated sidebar and added pro version discount
- Fix: Outdated links to old website
- Fix: Prevent requests to invalid tabs
1.2.10 – June 2, 2016
- Fix: CSS not loaded on details page
1.2.9 – December 8, 2015
- Fix: Bug with case-insensitive searches in serialized objects
- Fix: Bug with early skip due to lack of primary key
1.2.8 – November 25, 2015
- Fix: Bug with report details
1.2.7 – November 24, 2015
- Fix: Untranslateable string
- Tweak: Check BSR_PATH instead of ABSPATH to be consistent
- Tested with 4.4
- Removed unused code/small cleanup
- Improved progress bar info and styles
- Small cleanup
- Added „Settings saved“ notice when saving settings
- Fixed bug with wp_magic_quotes interfering with some search strings
- Fixed bug with searching for backslashes
- Fixed potential bug with getting tables in large multisites
- Fixed potential notice in append_report
- Improved handling of missing primary keys
- Fixed AJAX conflict with WooCommerce
- Fixed a few issues with translations
- Tweaked „System Info“ to use get_locale() instead of WP_LANG constant
- Updated German translation (props @Linus Ziegenhagen)
- Fixed minor issue with display of progress bar
- Updated translation file
- Switched to AJAX bulk processing for search/replaces
- Decreased minimum „Max Page Size“ to 1000
- Added „Help“ tab with system info for easier troubleshooting
- Added ability to change max page size
- Decreased default page size to prevent white screen issue on some environments
- Added ability to change capability required to use plugin
- Small bugfixes and translation fixes
- Added table sizes to the database table listing
- Added French translation (props @Jean Philippe)
- Added support for case-insensitive searches
- Added German translation (props @Linus Ziegenhagen)
- Potential security fixes
- Fixed issue with searching for special characters like ‘\’
- Fixed bug with replacing some objects
- Fixed untranslateable strings on submit button and submenu page.
- Fixed issue with loading translations and added Spanish translation (props Eduardo Larequi)
- Fixed bug with reporting timing
- Updated to use „Dry Run“ as default
- Added support for WordPress Multisite (see FAQs for more info)
- Initial release