WordPress.org

Support

Support » Plugins and Hacks » [Plugin: Gravity Forms Custom Post Types] Multi-Select field does not save all taxonomies

[Plugin: Gravity Forms Custom Post Types] Multi-Select field does not save all taxonomies

Viewing 6 replies - 1 through 6 (of 6 total)
  • Iā€™m having the same issue with the multi-select and taxonomies.
    Also using version 3.0.1
    Any idea when this will be updated?

    Thanks

    Plugin Author bradvin
    Participant

    @bradvin

    hey guys,

    This has been fixed in V4 beta, but it is not released yet, as I am still testing it. Please check out the new features and test it to see that it works for you.

    http://themergency.com/gravity-forms-custom-post-types-v4-beta-testers-wanted/

    cheers

    For what it’s worth, here is what our developer wrote about the problem:

    CPT addon doesn’t properly account for multiselect boxes. GF turns
    multiselect values into a comma-separated string, which it was then
    casting as an integer, with the result that something like ‘3,10,12’
    would become simply ‘3’. Thus only the first field was being saved to
    the post.

    Here is the patch we applied until V4 is ready:

    diff --git a/wp-content/plugins/gravity-forms-custom-post-types/gfcptaddonbase.php b/wp-content/plugins/gravity-forms-custom-post-types/gfcptaddonbase.php
    index 9748d14..4359244 100644
    --- a/wp-content/plugins/gravity-forms-custom-post-types/gfcptaddonbase.php
    +++ b/wp-content/plugins/gravity-forms-custom-post-types/gfcptaddonbase.php
    @@ -413,6 +413,10 @@ function save_taxonomy_field( &$field, $entry, $taxonomy ) {
                   $terms = $entry[$field['id']];
                   if ( !empty($terms) )
                     wp_set_post_terms( $entry['post_id'], $terms, $taxonomy );
    +            } else if ( array_key_exists( 'type', $field ) && $field['type'] == 'multiselect' ) {
    +              // terms are passed as comma-separated
    +              $term_ids = wp_parse_id_list( $entry[$field['id']] );
    +              wp_set_object_terms( $entry['post_id'], $term_ids, $taxonomy, true );
                 } else {
                     $term_id = (int) $entry[$field['id']];
                     if ( $term_id > 0 )

    Thanks so much, Brad, for your continuing support for this essential plugin!

    minute14
    Member

    @minute14

    I just downloaded and installed v4 beta and the issue with multiple selections not posting still exists. I would like to add the above code to resolve it. Where and what file i would need to add it? functions.php in my theme?

    Thanks again for the great plugin! šŸ™‚

    minute14
    Member

    @minute14

    I just deleted the beta version and reinstalled the currentone.

    Where does the above code go? gfcptaddonbase.php?

    Thanks again šŸ™‚

    Plugin Author bradvin
    Participant

    @bradvin

    Hi there

    I just checked the code in V4 beta and it does something very similar to the code posted above, so it does save multiple taxonomies. What type of field are you using?

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: Gravity Forms Custom Post Types] Multi-Select field does not save all taxonomies’ is closed to new replies.