Resumo de IA
Descrição
The wpforms_frontend_output_success action is triggered immediately after the form submission.
Parâmetros
- $form_data
- (array) Configurações/dados do formulário processados, preparados para uso posterior.
- $fields
- (array) Valores/propriedades dos campos de envio sanitizados.
- $entry_id
- (int) Entry ID.
Fonte
wpforms/src/Frontend/Frontend.php
Mais Informações
The action fires immediately after the form submits prior to saving the entry and sending the email notification.
Exemplos
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 );