Search and replace in WordPress

search-replace, search and replace, database, url, http to https, migration · 0 found this helpful

Search and replace changes text everywhere in your WordPress database. Use it to swap an old address for a new one after a move, or http:// for https:// after you add SSL. You can run it from your account without SSH, and you can undo it for 7 days.

Preview the changes

  1. Open Account → Hosting → your site → Websites, pick your WordPress site, and open the Tools tab.
  2. In Search and replace, enter the text to find and the text to replace it with. For example, find http://example.ca and replace it with https://example.ca.
  3. Leave Leave post IDs (GUIDs) alone ticked. WordPress uses them as permanent IDs, and feed readers rely on them.
  4. Click Preview changes.

The preview counts matches in each table. Nothing changes yet.

A search and replace preview with matches counted per table

Run it

  1. Untick any table you want to leave alone.
  2. Click Replace, then confirm.

We take a restore point of the whole site first. It's listed under Site controls as Before a search and replace. The replacement starts as soon as the restore point is saved, which takes a minute or two on a large site.

The task keeps running if you leave the page. You'll see it in your task tray, and it appears under Recent replacements when it's done.

Settings that plugins store in a packed format are updated safely, and their lengths are kept correct. A value that only its plugin can read is left alone and counted in the preview. Row IDs are never changed.

When the run finishes, WordPress's object cache is emptied so the site reads the new values. If you use a page caching plugin, purge its cache too, or visitors may see old pages for a while.

Undo a replacement

  1. Under Recent replacements, click Undo beside the run.
  2. Confirm.

We put back every value the run changed. A value that the site changed since then is left as it is, so newer edits aren't lost. Undo is available for 7 days.

To put the whole site back instead, roll back to the restore point taken before the run. See Undo a WordPress change with a restore point.

If something goes wrong

  • Use at least 3 characters: short searches match too much. Use a longer, more specific phrase.
  • That preview is more than 30 minutes old: the counts may have changed. Preview again.
  • Another search and replace is still running: wait for it to finish, then try again.
  • We couldn't take a restore point: nothing changed. Check that your account has free space, then try again.
  • The site turned the request away: the task needs to reach your site. If it's password protected or runs a firewall plugin, pause that for a moment, then try again.
  • This server's malware protection blocked the tool: nothing changed. Contact us and we'll allow it for your site.
  • Skipped tables: a table with no unique row ID can't be updated safely, so it's counted but never changed.

Was this helpful?

Still stuck? Ask us and we'll walk you through it.