The Caldera globe logo with the words Caldera Forms below it

This filter was added in Caldera Forms 1.5.0

This dynamically named filter allows for adding custom validation to a field, by its field ID. The last part of the filter name is the id, use “caldera_forms_validate_field_fld_123456789” to affect a field with the ID of fld_123456789.

You may want to use the caldera_forms_validate_field_$field_type filter to target all fields of a given type.

This filter can be used to change the value of a field before it is saved. Also, it can be used to trigger validation errors. Returning a WP_Error on this filter will cause the form submission to stop and the WP_Error message to be displayed below the form.

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