The wpforms_process_complete action fires at the very end of (successful) form entry processing.


(array) Sanitized entry field values/properties.
(array) Original $_POST global.
(array) Processed form settings/data, prepared to be used later.
(int) Entry ID. Will return 0 if entry storage is disabled or using WPForms Lite.



More Information

The wpforms_process_complete hook fires at the very end of form processing. It only fires if the entry was successful and did not contain errors. Saving the entry to the database and sending the email notifications are done prior to this hook running.

A popular choice when building custom API integrations or needing to perform any kind of action after an entry is successfully submitted (eg sending a custom email notification, creating a post or user account, etc).

An alternate version of this hook is available to easily limit by form ID, wpforms_process_complete_{$form_id}.

Important note: If you are doing processing and need to be able to return an error and prevent form processing, use wpforms_process hook instead.


For an example, see Bill Erickson’s Integrating your contact form with external services.

Just remember to change your form ID from 5 to the form ID that you’re targeting.

 * This will fire at the very end of a (successful) form entry.
 * @link
 * @param array  $fields    Sanitized entry field values/properties.
 * @param array  $entry     Original $_POST global.
 * @param array  $form_data Form data and settings.
 * @param int    $entry_id  Entry ID. Will return 0 if entry storage is disabled or using WPForms Lite.

function wpf_dev_process_complete( $fields, $entry, $form_data, $entry_id ) {
    // Optional, you can limit to specific forms. Below, we restrict output to
    // form #5.
    if ( absint( $form_data[ 'id' ] ) !== 5 ) {
	// Get the full entry object
	$entry = wpforms()->entry->get( $entry_id );

	// Fields are in JSON, so we decode to an array
	$entry_fields = json_decode( $entry->fields, true );

	// Check to see if user selected 'yes' for callback
	if($entry_fields[6][ 'value' ] === 'Yes') {
		// Set the hidden field to 'Needs Callback' to filter through entries
		$entry_fields[7][ 'value' ] = 'Needs Callback';

	// Convert back to json
	$entry_fields = json_encode( $entry_fields );

	// Save changes
	wpforms()->entry->update( $entry_id, array( 'fields' => $entry_fields ), '', '', array( 'cap' => false ) );

add_action( 'wpforms_process_complete', 'wpf_dev_process_complete', 10, 4 );

Reference Articles

How to Add a Year to the WPForms Entry Date