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 builder.
Formidable Forms is the best WordPress Form Builder plugin. Get it for free!
Usage
add_filter( 'frm_fields_in_form_builder', 'my_custom_function');
Parameters
- $fields (array): The list of fields.
- $args (array): Include form.
Examples
Remove all Likert fields from the form builder
You can use the following example to remove all Likert fields from the form builder.
add_filter( 'frm_fields_in_form_builder', 'remove_likert_form_builder', 10, 2);
function remove_likert_form_builder( $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;
}