Editing Caldera Forms Entries With PHP

Caldera Forms Banner

Caldera Forms provides PHP helper utilities to read and update Caldera Forms entries. This document is designed to help you understand the best ways to modify saved Caldera Forms entry data. All Caldera Forms entry data is saved in custom tables. For forward-compatibility and ease of use it is not recommend that you directly query that data.

Please note, this is developer-focused documentation. There are very easy ways to edit form entries documented here:

How To Edit Caldera Forms Entries

Important: This documentation is updated for Caldera Forms

Using The Entry Object

Caldera Forms provides an entry object Caldera_Forms_Entry. It is best to use this database abstraction when working with multiple fields of an entry or its meta data. If you just need to edit one field’s value, this method is overkill.

The Caldera_Forms_Entry class can be used to retrieve saved entries or create new entries. In this example, it is used to get one entry from the database, and modify the value of a field:

This code could be adapted to modify more or even all of the entries fields. It is provided as an example of working with Caldera_Forms_Entry.

Update The Value Of One Saved Caldera Forms Field

If you really do just need to update the value of one saved field from Caldera Forms entry, the simpler way is to use Caldera_Forms_Entry_Update::update_field_value(). This method was added in Caldera Forms

As you can see, this method, while it has less capabilities, than using Caldera_Forms_Entry, is way simpler and could be condensed into one line of code.

Delete Caldera Forms Entries

There are also methods provided for deleting entries:

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