I have a flexible content field that is defined as follows. The layout value is empty:
{
"key": "field_6576a2f9f2147",
"label": "Content",
"name": "content",
"type": "flexible_content",
"layouts": {}
}
Now fields are created dynamically in PHP, which I would like to summarise in layouts and add to the flexible content field.
I know that I can add a field to an existing group using the parent attribute of acf_add_local_field. But how can I add it to a Flexible Content field?
The best solution I have found so far is to manipulate the field after on load
function fb_change_layouts( $field ){
$field['layouts'] = …
return $field;
}
add_filter( 'acf/load_field/key=field_6576a2f9f2147', 'fb_change_layouts');