Summary:
A WordPress site using Advanced Custom Fields (ACF) was experiencing issues where linked posts in a relationship field redirected users to an outdated domain. The source of the issue was serialized data in ACF relationship fields that hadn’t been updated after a domain migration. Freshy resolved this by using a search-and-replace plugin to correct the URLs within serialized data safely.
Issue background
The client reported that clicking on certain post links (generated via ACF relationship fields) redirected users to an older version of the site hosted on a different domain. These links appeared in various custom layouts and template views throughout the site.
Diagnosis
- Freshy verified that the links were generated dynamically via ACF relationship fields.
- The problem wasn’t with hardcoded links — it stemmed from serialized data stored in the
postmetatable. - These serialized values still contained the old domain, which caused WordPress to redirect or incorrectly resolve the permalink.
Resolution steps
- Back up the database
Always take a full database backup before modifying serialized data. - Use a serialization-aware plugin
Installed and ran the Better Search Replace plugin to find and replace the old domain with the current one. Enabled the option to handle serialized data correctly. - Run a dry test
Executed a dry run to ensure the number of replacements matched expectations. - Execute replacement
Confirmed the actual replacement operation on affected tables likewp_postmeta. - Clear caches
Cleared all caching layers (server, plugin, and browser) to ensure changes took effect sitewide.
Final outcome
The relationship links now correctly point to the active site domain, and no further redirects occur. Freshy confirmed the fix across multiple ACF fields and templates.
Having trouble with old URLs or ACF data after a migration? Contact Freshy — we’ll help you track down lingering redirect issues and get your WordPress site running cleanly again.