Fixing Stale Source-Site URLs Left Behind After a WordPress Migration
A page migrated fine, mostly — except an image or two still loads from the old site, or a link still points back at staging instead of the live domain. It usually traces back to one specific moment: the page was pushed while something was broken on the receiving end — a license that had lapsed, reference resolution briefly unavailable — so the content arrived, but the URLs inside it never got rewritten to point at their new home. The fix isn't re-pushing the whole page again; it's repairing exactly the URLs left behind.
Why a sitewide find/replace is the wrong tool for this
WordPress has plenty of generic search-and-replace plugins, and the instinct is reasonable: find the old domain, replace it with the new one, done. The problem is scope. A sitewide tool has no way to tell a genuine, intentional mention of that URL — a blog post that legitimately links to the old site, a code sample, a screenshot caption — apart from an actual migration leftover. It'll "fix" both the same way, which means it can just as easily break something that was correct.
The fix that's actually safe is scoped to exactly the content a migration tool itself wrote: posts PostDeploy's own import step actually touched on this site, nothing else. A match there is never a coincidence — it's either from a migration, or it isn't in scope at all.
Preview first, then apply
Nothing gets changed on a scan. The exact same walk through the content runs twice — once to count matches and report back what it found, once (only when explicitly confirmed) to actually write the replacement. There's no in-between state where something's half-changed; either you're looking at a preview of what would change, or you've explicitly told it to apply that same change for real.
Why this can't be a naive string replace
A URL doesn't only show up in plain text. It can be buried inside serialized PHP data — an array, a nested structure some other plugin stored as a single meta value. Running a plain string replace directly on that raw serialized text is a real way to corrupt it: PHP's serialization format stores a string's exact length as a number right before the string itself, so changing the string's length (which replacing one URL with a different-length one almost always does) without updating that stored length breaks the whole structure, and WordPress can no longer read it back at all.
The safe way is reading the value as the real PHP structure it represents first — not the raw stored string — making the replacement inside that real structure (walking into arrays and nested values wherever a string might be hiding), and only then letting WordPress re-serialize it correctly on save. The length-prefix problem never comes up, because nothing ever touches the raw serialized bytes directly.
A WordPress-specific gotcha worth knowing about
Custom fields aren't always unique per post — the same meta key can legitimately appear more than once on the same post (a repeating custom field is a common pattern). A naive update that only matches by key would collapse every row sharing that key down to a single value, silently losing the others. The correct update has to target the exact original value being replaced, not just the key it's stored under, so a repeated field's other rows are left alone.
What PostDeploy does about all of this
Find & Replace scans every post this site's own PostDeploy install actually wrote through a migration — content fields (title, content, excerpt) and every piece of post meta, serialized data included. Preview shows exactly what would change before anything does; Apply performs the identical walk for real, and the action is recorded in the audit log afterward. It never touches content this plugin didn't put there in the first place, so there's no risk of "fixing" a URL that was never a migration leftover to begin with.
Try it
Find & Replace is a Pro feature, since it repairs content Pro's own reference resolution is responsible for. PostDeploy Free moves Posts, Pages, and custom post types. PostDeploy Pro adds ACF/Elementor/WPML reference resolution, Rollback, and tools like this one for when something still needs a fix.