Hooks and filters

Updated November 10, 2026

KodaChoices has four PHP filters. Add code like the examples to your theme’s functions.php or a code snippets plugin.

kodachoices_field_applies

Decide whether KodaChoices draws a field right now. Return false to show Gravity Forms’ plain choices.

ArgumentWhat it is
$appliestrue
$fieldThe Gravity Forms field
add_filter( 'kodachoices_field_applies', function ( $applies, $field ) { return 7 === (int) $field->formId ? false : $applies; }, 10, 2 );

kodachoices_validation

Change KodaChoices’ validation result for a field, after its own checks (unavailable choices, limits, one per person, rules and how many can be chosen).

ArgumentWhat it is
$resultGravity Forms’ validation result: is_valid and message
$fieldThe field
$chosenThe values chosen
add_filter( 'kodachoices_validation', function ( $result, $field, $chosen ) { if ( 5 === (int) $field->id && in_array( 'vip', $chosen, true ) && ! is_user_logged_in() ) { $result['is_valid'] = false; $result['message'] = 'Please log in to choose VIP.'; } return $result; }, 10, 3 );

kodachoices_style_presets

Add, change or remove presets offered under New style. Each preset is a name, a description and the settings that differ from the defaults (setting keys as in Style settings; see the plugin’s includes/class-kchoices-styles.php for the exact keys).

add_filter( 'kodachoices_style_presets', function ( $presets ) { $presets['brand'] = array( 'name' => 'Brand card', 'description' => 'Our colors.', 'values' => array( 'accent' => '#0f766e', 'radius' => 4 ) ); return $presets; } );

kodachoices_pdf_media

Return false to keep a field as plain text in Gravity PDF while still showing pictures on the entry screen and in emails.

add_filter( 'kodachoices_pdf_media', function ( $show, $field ) { return 'icon' === $field->kchoicesMode ? false : $show; }, 10, 2 );
Was this page helpful?
Scroll to top