Support » Plugin: Gravity Forms + Custom Post Types » Multi-selects only passing first value in custom taxonomy

Viewing 3 replies - 1 through 3 (of 3 total)
  • Having this problem as well.

    I fixed it by using checkboxes which are easier for users to use, so a real fix for multi select isn’t pressing for me, but works as described by function5.

    sparkingproducts

    (@sparkingproducts)

    +1 for this, I’ll be looking for a fix today and I’ll keep you updated if I find one.

    sparkingproducts

    (@sparkingproducts)

    this is a pretty complicated fix, I’m sure someone could dumb this down but I hope this points the author of the plugin in the right spot if they ever try to tackle it.

    In the file gfcptaddonbase.php add this code on line 420. You will need to change the $entry[‘#’] to the number that equals your taxonomy’s tag_ID. They match up in two spots, so in my code I have 34,35,36 and 37. Where it says 34 it needs to match in both spots.

    I have 4 taxonomies I’m using with this so it could be quite a bit shorter if you only have 1 or 2. Hopefully someone can take this and wrap it up a bit nicer

    } else if ( array_key_exists( 'type', $field ) && $field['type'] == 'multiselect' ) {            
    
    				$term_ids = array();
                    if (!$entry['34'] == '') {
    					$arr = $entry['34'];
    					$term_ids = explode(",",$arr);
    					foreach ($term_ids as $term_ints) {
    						$final[] = intval($term_ints);
    					}
    				   wp_set_object_terms( $entry['post_id'], $final, $taxonomy, true );
    				}
                    if (!$entry['35'] == '') {
    					$arr = $entry['35'];
    					$term_ids = explode(",",$arr);
    					foreach ($term_ids as $term_ints) {
    						$final[] = intval($term_ints);
    					}
    				   wp_set_object_terms( $entry['post_id'], $final, $taxonomy, true );
    				}
                    if (!$entry['36'] == '') {
    					$arr = $entry['36'];
    					$term_ids = explode(",",$arr);
    					foreach ($term_ids as $term_ints) {
    						$final[] = intval($term_ints);
    					}
    				   wp_set_object_terms( $entry['post_id'], $final, $taxonomy, true );
    				}
                    if (!$entry['37'] == '') {
    					$arr = $entry['37'];
    					$term_ids = explode(",",$arr);
    					foreach ($term_ids as $term_ints) {
    						$final[] = intval($term_ints);
    					}
    				   wp_set_object_terms( $entry['post_id'], $final, $taxonomy, true );
    				}
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Multi-selects only passing first value in custom taxonomy’ is closed to new replies.