The Caldera globe logo with the words Caldera Forms below it

This action fires before the post-processors run. This makes it an excellent option for saving or accessing field data once all validation and processors have run.

It is passed 4 parameters:

  • $form – the form config array
  • $referrer – the referring url structure
  • $process_id – the unique id given to the form submission
  • $entry_id – The ID of the entry that is currently being created

In this example, we set a value stored in the SESSION super global in a field:

Often times when you are using a select field, such as a dropdown, with auto-populated options from posts, using the post name as the field value is desired, but does not create valid HTML markup. In these cases, it is better to use the post ID as the field value, with the post name as the label.

But, when using the {summary} magic tag, your email will contain the ID, not name of the post, which is not very useful. This hook can be used to change the field’s value from post ID, back to post title:

You might also wish to change the value of a form field, based on what its value is. This is useful for adding additional validation or sanitization. For example, to convert certain values to one specific value:

Because all input validation has passed, you can now safely get field data and use it to submit to a different API or use an alternative storage method:

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