Home › Forums › Add-ons › Flexible Content Field › Add field to layout 'sub_fields' via php › Reply To: Add field to layout 'sub_fields' via php
Try setting ‘parent’ to the field key of the ‘layouts’ of the flex fields.
Here is the portion of an exported field group with a flex field.
'fields' => array(
array(
'key' => 'field_54fca97e88819',
'label' => __('Panels'),
'name' => 'blunt_panels',
'prefix' => '',
'type' => 'flexible_content',
'instructions' => ''
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
),
'button_label' => __('Add Panel'),
'min' => '',
'max' => '',
'layouts' => array(
array(
'key' => '54fca987f37a3', // <= try this key as the parent
'name' => '1_column_simple',
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!
Our guide looks into WordPress custom fields and how they stack up against the possibilities of ACF.
— Advanced Custom Fields (@wp_acf) July 18, 2022
https://t.co/hk3yibkHyk
© 2022 Advanced Custom Fields.
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.