Home › Forums › General Issues › Group fields not saving.
Other fields are working good but, group’s sub fields doesn’t save on post update.
function my_theme_share_button_block_fields() {
acf_add_local_field_group(
array(
'key' => 'group_share_button',
'title' => esc_html__( 'Share Button', 'text-domain' ),
'fields' => array(
array(
'key' => 'field_share_title',
'label' => esc_html__( 'Title', 'text-domain' ),
'name' => 'title',
'type' => 'text',
),
array(
'key' => 'field_share_title_tag',
'label' => esc_html__( 'Title Tag', 'text-domain' ),
'name' => 'title_tag',
'type' => 'select',
'choices' => array(
'h1' => 'h1',
'h2' => 'h2',
'h3' => 'h3',
'h4' => 'h4',
'h5' => 'h5',
'h6' => 'h6',
'p' => 'p',
'span' => 'span',
),
'default_value' => 'h2',
),
array(
'key' => 'field_share_button',
'label' => esc_html__( 'Button', 'text-domain' ),
'name' => 'button',
'type' => 'group',
'layout' => 'row',
'sub_fields' => array(
array(
'key' => 'field_share_button_text',
'label' => esc_html__( 'Text', 'text-domain' ),
'name' => 'button_text',
'type' => 'text',
),
array(
'key' => 'field_share_button_url',
'label' => esc_html__( 'Url', 'text-domain' ),
'name' => 'button_url',
'type' => 'url',
),
array(
'key' => 'field_share_button_title_attr',
'label' => esc_html__( 'Title', 'text-domain' ),
'name' => 'button_title',
'type' => 'text',
'instructions' => esc_html__( 'The title attribute.', 'text-domain' ),
),
array(
'key' => 'field_share_button_new_tab',
'label' => esc_html__( 'New Tab', 'text-domain' ),
'name' => 'button_new_tab',
'type' => 'true_false',
'ui' => true,
),
),
),
),
'location' => array(
array(
array(
'param' => 'block',
'operator' => '==',
'value' => 'acf/my-theme-share-button',
),
),
),
'active' => true,
)
);
}
add_action( 'acf/init', 'my_theme_share_button_block_fields' );
WordPress: 5.6
ACF Pro: 5.9.3
Here is server info:
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!
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.