Support

Account

Home Forums ACF PRO Syncing ACF JSON between similar but diverged sites

Helping

Syncing ACF JSON between similar but diverged sites

  • We are trying to get ACF into JSON for version-control reasons. That’s easy and we don’t need any help with that.

    The problem that we are running into is that our dev and prod have had identically named fields manually added to both so their field key’s obviously don’t match now. In an ideal world, we’d just replace dev with a fresh copy of prod however we have staged content on dev right now so that isn’t an option for a couple of more weeks, probably. (When I say identically named fields, I mean that someone created the same component on both environments to fast-track a feature launch.)

    If we took the ACF as JSON from prod, placed it on dev and ran the sync, would things break or would the fact that the field names (first_name, last_name, etc.) match help even if the field keys (field_5cdc52ee191a8, etc.) are different?

    Or should we hold off on the ACF as JSON until we can get a fresh copy?

    On the frontend, our code 100% uses field names and never any field keys, if that matters.

  • If you sync the groups the site will break because the field keys do not match. This is highly dependent on the type of field in question though. If the fields are for simple text values then you should be okay, this is basically the fields listed under “Basic”

    If you don’t have a lot of content the issue can be fixed by editing every post that uses this component in the admin. In the admin edit ACF will be able to find and populate the values correctly. Then you update and acf will swap the field keys.

    You can also do a find and replace in the postmeta table in the db by finding all occurrences of the incorrect field key in meta_value and replacing it with the correct field key.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.