The Problem
Some post links were pointing to the site’s former domain—despite everything appearing up to date. These weren’t hardcoded URLs, but rather relationship fields powered by ACF and advanced custom fields, embedded throughout templates, field groups, custom layouts, and the WordPress dashboard. Even old WordPress URLs in wp_postmeta or site URL settings could cause redirect issues and 404 errors.
What We Found
ACF Relationship Data
The broken links came from ACF’s relationship fields, which were still referencing the old URL, old site, or old WordPress domain within serialized postmeta data. Parts that ACF stores in a serialize format meant that standard search-replace or PHPMyAdmin edits wouldn’t work—doing so can break the permalink structure, permalinks, internal links, or corrupt values in wp_options or db tables.
Serialized Structure
Since WordPress stores complex field data in a serialized format, standard search-and-replace techniques won’t work—doing so can break the structure and corrupt values.
How We Fixed It
1. Backed Up the Database
Always the first step—ensuring a recovery point via staging, dev, or backup before making mass changes.
2. Used a Safe Replace Tool
We installed the Better Search Replace plugin, redirection plugin, or replace plugin and enabled the option for serialized data handling to fix WordPress redirects and URLs within ACF fields.
3. Ran a Dry Test
Before committing changes, a test run confirmed how many entries, post IDs, or old URLs would be affected.
4. Replaced the Old Domain
With confidence, we replaced the outdated domain, old URL, or old WordPress address in the necessary database tables, especially wp_postmeta and wp_options table, and verified rewrite rules or permalink structure updates.
5. Cleared All Caches
After replacement, we cleared all site cache, browser cache, or wp-admin cache to reflect the changes immediately.
The Result
No more unexpected redirects, 301 redirects, or issues with new URLs. Relationship links now point to the correct domain, existing site URLs, or new field references, and ACF fields behave as expected across the WordPress site.
Having redirect headaches after a domain change?
Reach out to Integriti Studio — we’ll help clean up legacy data the right way.