KI-Zusammenfassung
Beschreibung
The wpforms_frontend_output_success action is triggered immediately after the form submission.
Parameter
- $form_data
- (array) Verarbeitete Formulareinstellungen/Daten, die zur späteren Verwendung vorbereitet sind.
- $fields
- (array) Bereinigte Feldwerte/Eigenschaften des Eintrags.
- $entry_id
- (int) Entry ID.
Quelle
wpforms/src/Frontend/Frontend.php
Weitere Informationen
The action fires immediately after the form submits prior to saving the entry and sending the email notification.
Beispiele
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 );