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.
This hook allows you to modify the list of fields in the form settings.
Usage
add_filter( 'frm_fields_in_settings', 'my_custom_function');
Parameters
- $fields (array): The list of fields.
- $args (array): Include form.
Examples
Remove all Likert fields from the form settings
You can use the following example to remove all Likert fields from the form settings.
add_filter( 'frm_fields_in_settings', 'remove_likert_form_settings', 10, 2);
function remove_likert_form_settings( $fields, $args ) {
if ( 13 != $args['form']->id ) {
return $fields; // Do not modify fields if this is not the form you want.
}
// Remove all Likert fields.
foreach ( $fields as $index => $field ) {
$field = (object) $field;
if ( 'likert' === $field->type ) {
unset( $fields[ $index ] );
}
}
return $fields;
}