Modifying Caldera Forms Fields Using Filters

Caldera Forms Banner

When a form is being rendered or processed, each field in the form’s configuration goes through a series of 3filters. The first is the caldera_forms_render_get_field filter. This is the most generic filter and should be used to target a specific field by field ID.

There are also two dynamic filters whose names are based on the field type or field slug.

The caldera_forms_render_get_field_type-{$type} affects all fields of a given type. For example you would use the filter caldera_forms_render_get_field_type-dropdown to affect all dropdown fields or caldera_forms_render_get_field_type-text for all text fields.

You should use this filter when you want to modify the configuration of all fields of the same type on all forms or one form.

The caldera_forms_render_get_field_slug-{$slug} affects all fields with a certain slug. This is useful when you have multiple forms, that have a field with the same slug, that need the same change.

Where Does This Code Go?

When using WordPress hooks to customize Caldera Forms or other plugins you should not modify the plugin files, or you will lose your changes when you update the plugin. Instead you should create a small plugin to hold the custom code. It's easy, learn how here.

Technically you can add the custom code to your theme's functions.php, but then you will not be able to change your theme and keep these customizations.

Learn More