Description
The wpforms_frontend_output_success
action is triggered immediately after the form submission.
Parameters
- $form_data
- (array) Processed form settings/data, prepared to be used later.
- $fields
- (array) Sanitized entry field values/properties.
- $entry_id
- (int) Entry ID.
Source
wpforms/src/Frontend/Frontend.php
More Information
The action fires immediately after the form submits prior to saving the entry and sending the email notification.
Examples
For this example, the form will be displayed after the form is submitted and just above the confirmation message but it will also display the values entered in each form field.
/* * Action fires immediately after the form submission * * @link https://wpforms.com/developers/wpforms_frontend_output_success/ * * @param array $form_data Form data and settings. * @param array $fields Sanitized entry field. values/properties. * @param int $entry_id Entry ID. */ function wpf_dev_frontend_output_success( $form_data, $fields, $entry_id ) { // Reset the form settings unset( $_GET[ 'wpforms_return' ], $_POST[ 'wpforms' ][ 'id' ] ); // Uncomment this line out if you want to clear the form field values after submission unset( $_POST[ 'wpforms' ][ 'fields' ] ); // Actually render the form. wpforms()->frontend->output( $form_data[ 'id' ] ); } add_action( 'wpforms_frontend_output_success', 'wpf_dev_frontend_output_success', 10, 3 );