What Better Search Replace does to your database
Better Search Replace adds a page under Tools > Better Search Replace. You enter the text to find, the replacement text and the tables to process, and the plugin walks through every row of those tables, replacing the text wherever it appears. The classic use case: after a domain change or a move to HTTPS, swapping http://old-domain.com for https://new-domain.com across posts, settings and metadata.
What sets it apart from a hand-written SQL query is serialized data. WordPress and many plugins (widgets, theme options, page builders) store serialized PHP arrays, where each string is prefixed with its length. A raw REPLACE query changes the text without fixing that length and leaves the value unreadable; Better Search Replace unserializes the value, makes the replacement, then serializes it again (see our definition of deserialization). A "Run as dry run" mode, checked by default, counts the affected cells without writing anything.
The plugin was created by Matt Shaw, acquired by Delicious Brains in 2016, and is now published on wordpress.org by WP Engine. Since version 1.4.9 it gets its updates from WP Engine's servers. The free version is complete for search and replace; the official site still describes a Pro version but lists no price, and the upgrade button inside the plugin points to WP Migrate, a paid migration tool from the same company.
When Better Search Replace is the right tool
Better Search Replace fixes a string repeated across the whole database, with no server access needed:
- Domain changes and moves to a new host: once the database is imported, you replace the old address with the new one.
- Switching to HTTPS: replacing
http://addresses clears most mixed content warnings (see our guide to HTTPS on WordPress). - Multisite: a subsite administrator only sees that subsite's tables; a super admin can process the whole network from the main site.
It is the wrong choice for moving a whole site: the plugin copies neither files nor the database, it only edits the database in place. For the transfer itself, a plugin like Duplicator or All-in-One WP Migration also handles the address replacement. If you have SSH access, the wp search-replace command in WP-CLI does the same job, serialized data included, with no plugin to install.
Better Search Replace strengths and limitations
Strengths
- Serialized data handled. String lengths are recalculated, where a raw SQL query breaks widgets and options.
- Dry run by default. The "Run as dry run" box is checked every time and shows how many cells would change, table by table.
- Precise table selection. The list shows each table with its size, so you can limit the run to a few tables.
- Free and simple. One page, three tabs, no account to create for the free version.
Limitations
- No undo. The free version does not back up the database: a mistyped string rewrites thousands of rows, as the developer's own FAQ warns.
- Dry run without the details. The dry run gives counts per table; seeing the exact changes requires the paid version.
- No regular expressions. Searches match exact text, case-sensitive or not.
- PHP 8.1 and WordPress 6.2 minimum. Since version 1.4.11, a host still on PHP 8.0 or older can no longer update the plugin.
- Unclear paid offer. No public price for the Pro version; the suggested upgrade is WP Migrate, at $99 per year for one site at the regular price.
The Better Search Replace settings we recommend
After a dry run, the form keeps your values but checks "Run as dry run" again: uncheck it only for the real run. First export the database with your usual backup tool (see our 3-2-1 backup strategy).
| Setting | Recommended value | Why |
|---|---|---|
| Search for and Replace with Tools > Better Search Replace > Search/Replace | The full address, protocol included, with no trailing slash on either side | Searching for just "old-domain" would also hit email addresses and any text that mentions the name. |
| Select tables Same screen | All tables for a domain change, only the relevant tables for a targeted fix | An address missed in a plugin table leaves broken links; a text fix has no reason to touch settings. |
| Run as dry run Same screen, Additional Settings | Checked (default) for the first pass | The number of cells found reveals a string that is too broad before anything is written. |
| Case-Insensitive Same screen | Unchecked (default) | A case-sensitive search avoids replacing variants you did not plan for. |
| Replace GUIDs Same screen | Unchecked (default) | The GUID is a post's permanent identifier for RSS readers: changing it can make old posts show up as new. |
| Max Page Size Tools > Better Search Replace > Settings | 20,000 (default), lowered toward 5,000 if errors occur | The plugin itself says to lower this value if processing stops; slow shared hosting often needs it. |
Who can use the toolbsr_capability filter (code) | Keep the manage_options capability | Only administrators should be able to rewrite the database; do not extend this access to other roles. |
- Keep a dated database export from before the replacement, and check that it opens.
- Run the dry run, then compare the number of cells found with what you expected before the real run.
- After the real run, save Settings > Permalinks without changing anything and clear the site cache.
- Check a few pages, a widget and the theme settings.
- Deactivate and delete the plugin once the job is done.
Better Search Replace security: a tool to remove after use
Published vulnerabilities are few, but two of them hit the core of the plugin:
- CVE-2023-6933, fixed in 1.4.5: PHP object injection. An object placed in the database without an account could be instantiated during a search and replace (CVSS 8.8). The plugin contained no usable gadget chain, but another plugin or theme could supply one (see our article on PHP deserialization and object injection).
- CVE-2022-2593, fixed in 1.4.1: SQL injection through table names, limited to an administrator account.
- Version 1.4.11: the changelog reports a fix for a possible SQL injection with multibyte character sets (GBK, Big5), by switching to prepared statements.
The most effective habit is simple: install the plugin for the migration, update it if it stays more than a few days, then delete it. Better Search Replace only runs in the admin and leaves no known trace in your public pages, so WP Feint has nothing to hide for it.
What WP Feint hides for Better Search Replace
Free version Handled by the free plugin Feint Security
Better Search Replace is one of the 50 most used plugins known to the free version. Pro goes further by renaming its files.
Free version
Nothing to remove
With Pro
Nothing more
Still visible
No known trace
Better Search Replace frequently asked questions
Can Better Search Replace break my site?
Yes, if the search string is too broad or mistyped: the replacement is permanent. Always back up the database and do a dry run before the real run.
Should I keep Better Search Replace installed after a migration?
No. The plugin is only useful at the moment of the replacement; deleting it afterward removes a powerful tool from the admin and one more plugin to keep updated.
Why does the dry run find cells but not show the changes?
The free version only reports the number of cells and changes per table. Viewing the exact changes is part of the paid offer.
Processing stops with an error. What should I do?
Lower the Max Page Size in the Settings tab, then run it again. If the error persists, the Help tab provides a system info file you can send to your host.