caldera_forms_render_get_field_type-{field_type}

Caldera Forms -- Responsive, drag and drop form builder.

This filter allows you to modify the field’s config before it’s rendered, based on the field type. While this is a good place to dynamically set options of select fields like checkbox, radio, dropdown etc, It would be best to do that by slug, since this would be run on all fields of that type and you’ll need to code in the appropriate switching.
See caldera_forms_render_get_field_slug-{field_slug}.

This filter is passed 2 parameters:

  • $field – the field config array
  • $form – the form config structure array

Here’s an example on populating a dropdown field from a remote json source, based on slug, but is done the same for type.

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

One thought on “caldera_forms_render_get_field_type-{field_type}”