Support » Plugin: Gravity Forms + Custom Post Types » BUG: checkboxes with custom taxonomy as source

  • There is a bug such that selected checkbox items are not saved when a custom taxonomy is the source.

    The issue is on line 315 of gfcptaddonbase.php:

    $field['inputs'][] = array('label' => $choice['text'], 'id' => $id);

    Despite the right side being valid, the assignment is not taking place. This in turn means that the code designed to handle this in save_taxonomy_field doesn’t work, and therefore nothing is saved.

Viewing 6 replies - 1 through 6 (of 6 total)
  • FYI – this is the error I’m seeing is Notice: Indirect modification of overloaded element of GF_Field_Checkbox has no effect in.

    If you write a solution, would love to see it posted here so I can implement it as well. I’ll be working one one as well.

    I don’t get the error in my console. I just worked it out. But I figured it had something to do with the reference. In the mean time, I’m scraping $_POST and wp_set_object_terms()-ing them manually.

    So what is the solution? How is line 315 fixed so that it works?

    I’m getting the same issue. Found this that explains the issue:

    Hopefully the developer can fix this plugin.

    For those wanting a fix change the function setup_taxonomy_field() to:

    function setup_taxonomy_field( &$field, $taxonomy ) {
                $first_choice = $field['choices'][0]['text'];
                $field['choices'] = $this->load_taxonomy_choices( $taxonomy, $field['type'], $first_choice );
                //now check if we are dealing with a checkbox list and do some extra magic
                if ( $field['type'] == 'checkbox' ) {
                    //clear the inputs first
                    $field->inputs = array();
                    $counter = 0;
                    //recreate the inputs so they are captured correctly on form submission
                    foreach( $field['choices'] as $choice ) {
                        if ( ($counter % 10) == 0 ) $counter++; //thanks to Peter Schuster for the help on this fix
                        $id = floatval( $field['id'] . '.' . $counter );
                        $field->inputs[] = array('label' => $choice['text'], 'id' => $id);

    FYI, in case anyone is wondering, the above AWESOME FIX by Scott Cariss goes into the gfcptaddonbase.php file within the Gravity Forms Custom Post Types plugin, at line 300.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘BUG: checkboxes with custom taxonomy as source’ is closed to new replies.