Oct 292015
 
WordPress Plugin Name: Better Search Replace
Plugin URL:https://wordpress.org/plugins/better-search-replace/

Plugin Author: WP Engine
WordPress profile: WP Engine
Plugin version: 1.4.5
Last updated: January 18, 2024 (3 months ago)
Tested up to (WP version): WP 6.4.4
Downloaded: 0
Rating: 5 (out of 5)

Description


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

Learn more about Better Search Replace Pro

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.

Supported Languages

  • English
  • French
  • German
  • Spanish

Want to contribute?

Feel free to open an issue or submit a pull request on GitHub.



FAQ


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:

  1. Backup the database on your current site
  2. Install the database on your new host
  3. On the new host, define the new site URL in the wp-config.php file, as shown here
  4. Log in at your new admin URL and run Better Search Replace on the old site URL for the new site URL
  5. 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.



Screenshots:


  1. The Better Search Replace page added to the "Tools" menu

    The Better Search Replace page added to the "Tools" menu

  2. After running a search/replace dry-run.

    After running a search/replace dry-run.



Other notes:




Latest Change log entry:


  • Security: Unserializing an object during search and replace operations now passes 'allowed_classes' => false to avoid instantiating the object and potentially running malicious code stored in the database (thanks to Wordfence for responsible disclosure on December 18, 2023 followed by development and testing of the fix by WP Engine)
  • Fix: A regression in version 1.4.4 which caused some search results to be skipped has been fixed to ensure only numeric keyed objects are skipped


Tags:


database, search and replace, search replace, search replace database, update urls

+ Jason's Comments

I have switched to an alternative Search and Replace plugin which gives more details of the search result.


Top