Home › Forums › Bug Reports › Weird acf/load_field behavior with combined db and json fields › Reply To: Weird acf/load_field behavior with combined db and json fields
I think I understand what you’re doing, though I’ve never tried it and I don’t know why it would have been working before and not working now, but I do have a possible solution.
Rather than just trying to assign the layouts to the using
$field['layouts'] = json_decode( $json, ARRAY_A );
you may need to look at adding them as local fields one at a time to the field group where you want them, and I’m not 100% sure of all the steps that would be involved with doing this. Have a look here https://www.advancedcustomfields.com/resources/register-fields-via-php/
You may need to look into the code for ACF. There is a hook that is run when a field group is loaded (don’t remember the hook right now) and you could add the layouts to the field groups at that point, before the field group is saved in ACFs cache. This could also be something to do with the cache and ACF may be caching the field group earlier than it did before. Once ACF has put a field group into its cache, any changes you make to it will basically be ignored.
Hope this helps.
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!