Support

Account

Home Forums ACF PRO Protecting Parent Theme Field Settings JSON

Solved

Protecting Parent Theme Field Settings JSON

  • Hello

    We use ACF Pro on several different sites that run on child themes but that also use important ACF fields from the parent theme

    We would like the users of those sites to be able to sync those fields (when there are updates) but NOT be able to edit them

    Is there a way that we can do that? Allow users to sync but not edit?

    Thanks in advance!

  • json files in the parent theme, if they are included by adding a json load point do not need t be synced into the database to work. If you don’t want these field groups to be synced then they should not be synced.

    Once a field group is synced from the parent theme a copy of that group is saved in that acf-json folder in the child theme if it exists. Once this happens the field group is forever disconnected from the parent theme.

    The “private” setting in the json file should be added to prevent syncing of the parent theme groups you do not want to allow editing of. This is explained on this page https://www.advancedcustomfields.com/resources/synchronized-json/

    If they have already been synced they will need to be deleted from the database for the child theme site.

  • Thanks @hube2

    That is really helpful, however, this particular statement does not quite ring true in practice for me:

    “Once a field group is synced from the parent theme a copy of that group is saved in that acf-json folder in the child theme if it exists — Once this happens the field group is forever disconnected from the parent theme”

    I have a multisite install with a parent theme and several child themes, all containing an acf-json folder

    From a site running a child theme, syncing field groups from the parent does not put copies in the child theme acf-json folder unless an edit to one of those field groups is made from the child theme site

    Even when that happens, however, there still seems to be a connection to the parent because, when such a field group is updated in the parent theme, the child theme site is given the option to sync which overrides the previous edits

    That is actually good for us and our goals but I wanted to mention it in case I am missing something

  • yes, a copy will only go into the child theme folder if it is edited.

    the other thing you are seeing has to do with the order that the field groups are added when the load point is added.

    If the load point for the parent is added in a way that causes them to be loaded first then this field group will override the version in the child theme. You can sync them and save them but this will ultimately not have any effect. Any changes to the field group in the child theme will only be visible when editing the group and have no affect on the field group when editing content.

    The condition I described happens when the parent theme json files are loaded after the child theme json files. This is what will normally happen.

    The difference is cause by where in the array of load points the parent theme load point is added.

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

You must be logged in to reply to this topic.