Home › Forums › General Issues › Json on child theme
I’m wondering if what I am trying to achieve is possible.
I have a master theme with a series of acf field groups /blocks.
I would like to be able to make additions (blocks) and changes to these field groups without affecting unchanged fields/blocks within the group..
The problem is, when you do this the newly saved group adds everything in that group into the Json folder, not just the additional create fields from the child themes UI…
Any updates to the parent themes Json data will be ignored in favour of child theme Json.
Ideally what I need is for the parent Json to be read and only the additional information to overwrite it from the child Json.
For instance if I choose to add or delete a block from the parent and push to all my sites as a master theme, anyone who had added a new block/field to the child site field group would not see these changes as their child Json version would take precedent.
Any ideas how I could implement this? Thanks.
There isn’t any way to do this. Once a field group is edited and saved on a child theme it will override the parent theme, as you have seen.
There isn’t any way that I know of to accomplish what you want to do, because there is no way to know what has or has not been changed in the child theme.
The only way to have a parent theme that you can update as well has child themes that can be modified you would have to have field groups in the parent that cannot be modified by setting the “private” flag in the JSON files for these groups and then add new field groups in the child theme for modifications.
Yeah I thought as much..
I’ve had a thought about how I can achieve this via the UI.
I have at the moment a field group called Blocks and it’s being cloned into a flexible content field.
I’m thinking I will have two seperate field groups, Parent Blocks and Child Blocks, with the child blocks being empty.
I assume the parent will be overwritten the second I save the child blocks field group and it will merge the two together in the flexible content clone.
I might mess about with making the parent blocks being private, I’ve not tested that.
Create another group that is empty and clone that into your other field group as well. Never add anything to this group. Allow this group to be synced and modified per site.
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
🚨 The 2023 ACF Annual Survey closes tomorrow! This is your last chance to complete the survey and help guide the evolution of ACF. https://t.co/0cgr9ZFOJ5— Advanced Custom Fields (@wp_acf) May 18, 2023
© 2023 Advanced Custom Fields.