WordPress.org

Ready to get started?Download WordPress

Forums

Gravity Forms + Custom Post Types
When taxonomy used with Multi Select, only one taxonomyi (7 posts)

  1. billras101
    Member
    Posted 2 years ago #

    Hi! Great addition to Gravity Forms.

    We're using custom post types AND custom taxonomies. We've set up a simple form to allow logged in users to submit new custom posts and select from a variety of custom taxonomy terms.

    Everything is working fine EXCEPT ... when we use a MULTI SELECT box with a custom taxonomy.

    The MULTI SELECT field populates properly.

    The FORM ENTRY data saves correctly -- we see multiple taxonomy terms saved with the submission data.

    Unfortunately, when we view the the new post via the custom post type edit page, only one custom taxonomy term appears to have been saved with the post data.

    Is there a way to get ALL of the custom taxonomy terms that are selected via the MULTI SELECT box to be saved with the new post?

    Bill :D

    http://wordpress.org/extend/plugins/gravity-forms-custom-post-types/

  2. billras101
    Member
    Posted 2 years ago #

    After a bit of tinkering, I think I figured out a fix. In the file gfctaddonbase.php ...

    - - - - - - -
    I UPDATED THIS FUNCTION:
    - - - - - - -

    [Code moderated as per the Forum Rules. Please use the pastebin]

    - - - - - - -
    TO THIS:
    - - - - - -

    [Code moderated.]

    - - - - -

    1. In the original, the first 'if' was looking for $field['type'] = 'checkbox', but the app returned the 'multiselect' when using the multi select field type.

    2. 'wp_set_object_terms' did not seem to work properly when adding multiple terms, so I swapped it out for wp_set_post_terms and used the string of ids returned by $$entry[$field['id']] (from the section of code after the 'else if') to populate the $term_ids variable.

    After testing, the revised code seems to be working as expected.

    Any concerns or advice ... ?

    Bill :D

  3. bradvin
    Member
    Plugin Author

    Posted 2 years ago #

    Hi Bill

    thanks for posting the code. I got it even though it is moderated above. My only concern is that checkboxes are not handled correctly now. I have been working on that exact function to fix your issue and I will paste the updated code so you can give it a go

    thanks again :)

    cheers
    Brad

  4. taeke
    Member
    Posted 2 years ago #

    Hi Bradvin,

    could you share the update? We are facing the same issue and can't see the code by Bill as it is moderated..

    Thanks!

  5. bradvin
    Member
    Plugin Author

    Posted 2 years ago #

    Hi taeke

    the original post from bill can be found here : http://pastebin.com/ykqenuar

  6. bradvin
    Member
    Plugin Author

    Posted 2 years ago #

    Sorry I cannot release my update yet, as I am in the middle of making some major changes and the plugin is not working :)

  7. taeke
    Member
    Posted 2 years ago #

    Thanks Brad!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic