Caldera Forms logo and name

This filter can be used to modify the configuration of a field before it is rendered. It is also used during form submission. Keep in mind there are two dynamically named filters for modifying fields as well.

One use for this filter is to change the default value of a field:

One excellent use for it is to change the options of a select field. In this example, a fields options are set using posts in a specific custom post type, with a specific value of a meta field:

Here is an example of how to reset the default value for a select field based on a custom field for the current user:

Use Pods Fields To Set Caldera Forms Field Defaults

How To Set Caldera Forms Field Default From ACF Field

This is the right hook to use if you wish to set the default value of a field using a valuy saved by Advanced Custom Fields (ACF)

Make A Field Not Required

You can use the “required” index of the array exposed by this filter to control if a field is required or not. This is a good way to avoid situations where a processor makes a field required.

Multiple Defaults For Checkbox Fields

Caldera Forms checkbox fields can have more than one default value, in Caldera Forms 1.6.0 or later.

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