public function updateGroupValue($value, $post_id, $field)
    {
        // Get old value
        if ($post_id === 'options') {
            $selectedGroups = get_field('event_filter_group', 'options');
        } else {
            $selectedGroups = get_field('mod_event_groups_list', $post_id);
        }
        // Return if settings value is empty to only auto-activate children on first save
        if (!empty($selectedGroups)) {
            return $value;
        }

        if (!empty($value)) {
            foreach ($value as $v) {
                $term_children = get_term_children($v, 'event_groups');
                if ($term_children) {
                    $value = array_merge($value, $term_children);
                }
            }
            $value = array_unique($value);
        }

        return $value;
    }
public function updateGroupValue($value, $post_id, $field)
    {
        // Get old value
        if ($post_id === 'options') {
            $selectedGroups = get_field('event_filter_group', 'options');
        } else {
            $selectedGroups = get_field('mod_event_groups_list', $post_id);
        }
        // Return if settings value is empty to only auto-activate children on first save
        if (!empty($selectedGroups)) {
            return $value;
        }

        if (!empty($value)) {
            foreach ($value as $v) {
                $term_children = get_term_children($v, 'event_groups');
                if ($term_children) {
                    $value = array_merge($value, $term_children);
                }
            }
            $value = array_unique($value);
        }

        return $value;
    }
public function updateGroupValue ( $ value , $ post_id , $ field ) { // Get old value if ( $ post_id === 'options' ) { $ selectedGroups = get_field ( 'event_filter_group' , 'options' ) ; } else { $ selectedGroups = get_field ( 'mod_event_groups_list' , $ post_id ) ; } // Return if settings value is empty to only auto-activate children on first save if ( ! empty ( $ selectedGroups ) ) { return $ value ; } if ( ! empty ( $ value ) ) { foreach ( $ value as $ v ) { $ term_children = get_term_children ( $ v , 'event_groups' ) ; if ( $ term_children ) { $ value = array_merge ( $ value , $ term_children ) ; } } $ value = array_unique ( $ value ) ; } return $ value ; }
Add term children to user group value
@param  string $value   the value of the field
@param  int    $post_id the post id to save against
@param  array  $field   the field object
@return string          the new value
Add term children to user group value