AI Summary
Description
The wpforms_emails_notifications_field_ignored
filter allows you to skip certain fields from being included in email notifications. By default, all fields are included unless this filter is used to explicitly ignore them. For example, you may want to remove file upload fields with File Access Restrictions enabled or ignore specific field IDs on certain forms.
parameter | type | description |
---|---|---|
$ignore | bool | Whether to ignore the field in the email. Defaults to false. |
$field | array | The current field data array. Contains details like field ID, type, and settings. |
$form_data | array | Form ID. |
Source
wpforms/src/Emails/Notifications.php
Example
/**
* Ignore restricted file upload fields in notifications for form ID 25.
*/
function wpf_dev_ignore_file_uploads( $ignore, $field, $form_data ) {
if ( $form_data['id'] == 25 && $field['type'] === 'file-upload' && ! empty( $field['is_restricted'] ) ) {
return true;
}
return $ignore;
}
add_filter( 'wpforms_emails_notifications_field_ignored', 'wpf_dev_ignore_file_uploads', 10, 3 );