The fastest way to do a search and replace in WordPress is wp search-replace 'old-value' 'new-value' via WP-CLI over SSH. It handles serialized data correctly, which is the one thing that breaks manual database edits. If you don't have shell access or don't want the command line, a plugin like Better Search Replace does the same job from wp-admin.
Either way, back up first. This operation touches your whole database at once, and there's no built-in undo.
Why you'd need this
Search and replace across the database comes up whenever a value is baked into content or settings and needs to change everywhere at once:
- Moving a site from a staging URL to the live domain, or from
http://tohttps:// - Changing a domain name entirely
- Restoring a duplicated or migrated site whose database still points at the old location
- Bulk-fixing a typo or outdated phone number, email, or company name across many posts
A plain find-in-database-editor approach fails here because WordPress stores some data as serialized PHP: arrays and objects flattened into a single text string with an exact character count baked in (s:8:"old text", where 8 is the byte length). Change the text without recalculating that count, and WordPress fails to unserialize the value at all. Widget settings, theme options, and some plugin data all use this format. Search and replace with a tool that understands serialization avoids the problem entirely; a manual SQL UPDATE or a plain-text find/replace in phpMyAdmin does not.
Before you run anything: back up
This is a whole-database operation, not a scoped edit. Take a fresh backup first, whichever layer you use:
- Your Flashcloud hosting account has daily automatic backups. See backing up your WordPress site for how to restore from those if something goes wrong.
- For a faster, more targeted rollback, export the database on demand right before you run the replace:
wp db export before-search-replace.sql, or use phpMyAdmin's export tab.
If the change is risky or you're not sure what will break, do it on a staging copy first, confirm the site still works, then repeat the same command on live.
Option 1: WP-CLI (recommended)
If you have SSH access, WP-CLI is the right tool. Connect to your account over SSH, navigate to the WordPress install's directory, and run:
wp search-replace 'https://old-domain.com' 'https://new-domain.com'
A few flags worth knowing:
--dry-run: shows what would change without touching the database. Always run this first.--skip-columns=guid: leaves theguidcolumn alone, which is standard practice sinceguidis meant to be a permanent identifier, not a live URL.--all-tables: also scans tables outside the standard WordPress prefix, useful if a plugin created its own tables.--precise: uses PHP string functions instead of SQLREPLACE(), slower but more reliable on multibyte or unusual text.
A full dry-run-then-commit sequence for a domain change:
wp search-replace 'https://old-domain.com' 'https://new-domain.com' --dry-run wp search-replace 'https://old-domain.com' 'https://new-domain.com' --skip-columns=guid
WP-CLI reports how many replacements it made per table, so you can sanity-check the count before moving on.
Option 2: a plugin, if you don't have SSH
Better Search Replace (free, in the WordPress plugin directory) gives you the same underlying operation through a form in wp-admin:
- Install and activate it from Plugins → Add New, search "Better Search Replace."
- Go to Tools → Better Search Replace.
- Enter the old and new values, select the tables to search (default is all of them), and check Run as dry run first.
- Review the reported changes, then uncheck dry run and run it for real.
It handles serialized data the same way WP-CLI does, which is the whole reason to use a dedicated tool instead of a raw SQL query.
After the replace
Clear any caching layer so you're not looking at stale pages. Flashcloud hosting runs on LiteSpeed, and WordPress installs come with the LiteSpeed Cache plugin, so purge the cache from there if it's active on the account. Then load a few pages, check images and links resolved to the new value, and if it's a store, walk through a test checkout. If something looks wrong and you took a fresh export, restore it and try again with a narrower search term.
If the site was running slowly before or after a domain move and you want to rule out other causes, see my WordPress site is slow.
When to contact support
If a search-replace goes wrong, mismatched serialized data, a site that won't load, a database that looks corrupted, don't keep experimenting on production. Open a ticket from the portal's Support section. It reaches a real person, and if you have a recent backup or export on hand, mention it so they can restore quickly while sorting out the rest.