Skip to content
migration.tools
SQL dump to SQL dump

WordPress database search and replace

A plain find-and-replace on a WordPress database breaks widgets, theme options and page-builder layouts, because PHP serialized strings store their own length. This tool replaces the domain and recalculates every length prefix — the same job as WP-CLI search-replace, on a dump file, with nothing uploaded.

Going the other way? SQL dump to SQL dump

Options
One per line. Most specific first.

SQL dump

Updated dump

The result appears here as soon as there is input.

Processed on this device. Nothing you paste or drop is uploaded.

How to use it

  1. 1Export the database (phpMyAdmin, mysqldump or wp db export) and drop the .sql file.
  2. 2Enter the old and new URL. Add extra lines for http/https or www variants.
  3. 3Download the updated dump and import it on the new server.

Why serialized data breaks

WordPress stores arrays as PHP serialized text such as s:23:"http://old-site.example"; — the 23 is the byte length of the string. Replace the URL with a longer one and the length no longer matches, unserialize() fails, and WordPress silently falls back to defaults: widgets vanish, theme settings reset.

The tool walks each serialized string using its declared length, replaces inside it, and writes the new byte length — counting multi-byte characters and SQL escapes correctly, and handling serialized data nested inside serialized data.

Escaped URLs that are easy to miss

Elementor, Gutenberg block attributes and many plugins store JSON, where slashes are escaped: http:\/\/old-site.example. With “Also replace escaped forms” on, those and URL-encoded copies are replaced too.

If you are also moving from http to https, replace the full origin (http://old → https://new) rather than the bare domain, so every scheme reference is updated in one pass.

Questions

Is it safe to put my database dump in a web page?

The dump is read by JavaScript in your browser tab and never sent anywhere — there is no upload endpoint to send it to. You can confirm by loading the page, disconnecting from the network, and running the replacement offline.

Does it work for other PHP applications?

Yes. Any system that stores PHP serialized data in the database — Drupal 7, Magento, Joomla, custom apps — has the same problem and the same fix.

How big a dump can it process?

Dumps up to a few hundred megabytes work on a typical laptop; the limit is your browser's memory. For larger databases, run wp search-replace on the server.

Guides that use this tool