Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Dave from Gravity Wiz

    (@spivurno)

    Hi jcrea, you are correct and this is definitely a bug. Gravity Forms is going to be adding most of this plugins functionality to core in the near(ish) future so while we’re fixing small bugs were not fixing everything.

    Here’s an alternate solution as a stop-gap.

    1. Enable “Allow field to be dynamically populated” option for the Tax field.
    2. Add “default_term” as parameter name: https://grab.by/MIE4
    3. Copy and paste this code into your theme’s *functions.php* file:
    add_filter( ‘gform_field_value_default_term’, function() {
    return 444;
    } );
    4. Update “444” to the term ID of the term you wish to set as the default.

    Thread Starter jcrea

    (@jcrea)

    Thanks David for this, however, what if I have multiple forms that each need a different default term or a form that has multiple taxonomies each with a different default term?
    Thanks.

    Plugin Author Dave from Gravity Wiz

    (@spivurno)

    Here’s an alternate version that allows you to specify a different default value per field ID:

    https://pastie.org/private/eqs3xt1vugtjbo4ozkpug

    Thread Starter jcrea

    (@jcrea)

    Thanks again David.
    One more question.
    If you have multiple forms, how can you distinguish between which form gets the value applied?

    Plugin Author Dave from Gravity Wiz

    (@spivurno)

    The $field object also has a formId property. You can check for a specific form and field like so:

    https://pastie.org/private/g9mztt7nhlxvr3cgoo2sza

    Thread Starter jcrea

    (@jcrea)

    Thanks again David!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Default Taxonomy Term’ is closed to new replies.