Heads up!
This article contains PHP code and is intended for developers. We offer this code as a courtesy, but don't provide support for code customizations or 3rd party development.
This article contains PHP code and is intended for developers. We offer this code as a courtesy, but don't provide support for code customizations or 3rd party development.
Use this filter to customize the options shown in the new Autocomplete setting for Text type fields.
Usage
add_filter( 'frm_autocomplete_options', 'add_custom_autocomplete_option_for_field', 10, 2 );
Parameters
- $options (array): All of the options in the Autocomplete setting.
- $field (array)
Examples
Add additional autocomplete options
Use this code example to add additional autocomplete options for a specific field, e.g. Credit Card name.
/**
* @param array $options
* @param array $field
*/
function add_custom_autocomplete_option_for_field( $options, $field ) {
$target_field_id = 13; // change 13 to your text field ID
if ( $target_field_id !== (int) $field['id'] ) {
return $options;
}
$options['cc-name'] = 'Credit card name';
sort( $options );
return $options;
}
add_filter( 'frm_autocomplete_options', 'add_custom_autocomplete_option_for_field', 10, 2 );