DescriptionUsageParametersExampleSource Code
Description
This filter can be used to add custom options for each choice.
Usage
1234gform.addFilter('gform_append_field_choice_option', function (str, field, i) { // define the markup for your custom option return str;});
Parameters
str string
An empty string, to be replaced with your custom markup.
field array
The current field object.
i integer
The index of the current choice.
Example
This example adds a new option to the choice setting called custom.
It uses the gform_editor_js action to load the code snippet on the form editor page.
123456789101112131415161718192021add_action( 'gform_editor_js', 'custom_option_editor_script' );function custom_option_editor_script() { ?>