formcierge_after_submission
Action
Since v1.0.0
Fires after a form submission has been validated, saved to the database, and all built-in notifications have been queued. This is the primary hook for post-submission logic such as webhooks, CRM syncing, or custom emails.
Parameters
$form_id
int
The ID of the submitted form.
$entry_id
int
The ID of the newly created entry.
$data
array
Associative array of submitted field values keyed by field ID.
includes/Controllers/SubmissionController.php
Basic Usage
add_action( 'formcierge_after_submission', function ( $form_id, $entry_id, $data ) {
// Send data to a CRM
if ( $form_id === 42 ) {
my_crm_push( $data );
}
}, 10, 3 );
Real-World Examples
Push submission to a webhook endpoint
add_action( 'formcierge_after_submission', function ( $form_id, $entry_id, $data ) {
$webhook_url = get_option( 'my_plugin_webhook_url' );
if ( ! $webhook_url ) return;
wp_remote_post( $webhook_url, [
'body' => wp_json_encode( [ 'form_id' => $form_id, 'entry_id' => $entry_id, 'data' => $data ] ),
'headers' => [ 'Content-Type' => 'application/json' ],
'timeout' => 10,
] );
}, 10, 3 );
Create a WordPress post from form data
add_action( 'formcierge_after_submission', function ( $form_id, $entry_id, $data ) {
if ( $form_id !== 7 ) return;
wp_insert_post( [
'post_title' => sanitize_text_field( $data['field_title'] ?? '' ),
'post_content' => wp_kses_post( $data['field_body'] ?? '' ),
'post_status' => 'publish',
'post_type' => 'testimonial',
] );
}, 10, 3 );