Home Forums ACF PRO ACF JSON sync IDs different


ACF JSON sync IDs different

  • Hello,

    When using acf-json (with development and production servers), and setting a field group to display for a specific post/page, the development database will often/always have a different ID than on the production database. So when a user edits a post/page on the production site, the field group does not know to display.

    Other location rules such as post type/option page/user form don’t have this issue because there is no difference in those between development and production.

    I am able to save the field group on the production site so the issue is corrected, but on the next deployment the JSON file is overwritten and the issue is back.

    Looking for help with a way to avoid this.

    Thank you!

  • Hi @emrl

    ACF uses the post/page ID if you set the rule to a certain post/page. Unfortunately, there’s nothing ACF can do because they are different installations with different databases.

    What you can do, though, is cloning the database so both development and production site has the same database. Thus they have the same post/page IDs.

    Another thing you can do is manually changing the post/page ID in the JSON files. I believe there are several applications that can do it in bulk. For example, this page is talking about Notepad++:

    I hope this makes sense ๐Ÿ™‚

  • Thank you, I understand the reasons behind it. But I’m wondering if maybe location options should be handled differently, maybe only using the JSON as a default unless a database value is present or something.

    I guess right now I would have to create an options page, with a Post Object field that would allow a user to select a post/page, and then create a custom location filter that checks against that option value. That way the selected page could be different on development vs production.

  • Hi @emrl

    Yeah, I think the options page method will work.

    If you want, you can also create a custom location rule that will check the page name (slug) instead.

    I hope this makes sense ๐Ÿ™‚

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

You must be logged in to reply to this topic.