Hi all.
I’m trying to save some custom field group meta to my acf field group. I want to use this meta to further expand some logic for my wordpress theme.
I am able to get the meta field to show, But no matter what i do i do not seem to be able to save the value to my field group, Hopefully someone can point me in the correct direction.
add_filter(
'acf/field_group/additional_group_settings_tabs',
function ( $tabs ) {
$tabs['additional_settings'] = "Additional Settings";
return $tabs;
}
);
add_filter('acf/field_group/render_group_settings_tab/additional_settings', 'add_additional_settings_fields');
function add_additional_settings_fields($field_group) {
acf_render_field_wrap(array(
'label' => 'Is Component',
'type' => 'true_false',
'name' => 'is_component',
'value' => isset($field_group['is_component']) ? $field_group['is_component'] : 0,
'instructions' => 'Check this box if this Field Group belongs to a component.',
'ui' => 1, //
), 'div', 'acf-field-component-flag');
return $field_group;
}
add_filter('acf/update_field_group', 'save_additional_settings_field_group_settings', 10, 1);
function save_additional_settings_field_group_settings($field_group) {
if (isset($_POST['is_component'])) {
$field_group['is_component'] = $_POST['is_component'];
}
return $field_group;
}