Resumo de IA
Descrição
The wpforms_entry_email_data filter applies to entry fields before a form notification email is sent.
Parâmetros
- $fields
- (array) Valores/propriedades dos campos de envio sanitizados.
- $entry
- (array) Variável global $_POST original.
- $form_data
- (array) Configurações/dados do formulário processados, preparados para uso posterior.
Fonte
wpforms/includes/class-process.php
Mais Informações
The wpforms_entry_email_data filter is applied to the form field information used when creating and sending form notifications emails.
This filter can be used to modify the submitted form field details in the notification emails.
Exemplos
Remember to change your form ID from 890 to the form ID that you’re targeting.
/**
* Filter applies to entry fields before a form notification email is sent.
*
* @link https://wpforms.com/developers/wpforms_entry_email_data/
*
* @param array $fields Sanitized entry field values/properties.
* @param array $entry Original $_POST global.
* @param array $form_data Form data and settings.
*
* @return array
*/
function wpf_dev_entry_email_data( $fields, $entry, $form_data ) {
// Only run on my form with ID = 890
if ( absint( $form_data[ 'id'] ) !== 890 ) {
return $fields;
}
foreach ( $fields as &$field ) {
if ( empty( $field[ 'value_choice' ] ) ) {
continue;
}
// Default is a dash -, change here to what you need.
$delimiter = ' : ';
$field[ 'value' ] = $field[ 'value_choice' ] . $delimiter . wpforms_format_amount( $field[ 'amount_raw' ], true );
}
return $fields;
}
add_filter( 'wpforms_entry_email_data' , 'wpf_dev_entry_email_data', 10, 3 );
If you need any help on where to find your form and field IDs, please review this tutorial.
Artigos de Referência
Como Alterar o Delimitador de Pagamento Dentro das Notificações por E-mail