How do I conditionally exclude fields from notification email?
-
I have a number of Dropdown fields with a dash as the default value. Other values are numbers (it’s to choose how many of an item to order).
To reduce ‘noise’ in the notification email I would like to exclude fields where the value is the default dash value.
What is the easiest way?
I did get it working but it is fragile:
1) check field value using ‘wpforms_html_field_value‘ filter and note those that are not integers – I could not check for dash as dash == a€“ !
2) Use ‘wpforms_email_message‘ filter to search for section with the fields noted above and set the ‘table’ style to ‘display:none’If anything changes in wpforms-lite/includes/emails/templates/field-default.php my code will break.
Is there another filter that I could use to stop the field table from being appended to the $message?
Would you be open to a pull request for a new filter?
- The topic ‘How do I conditionally exclude fields from notification email?’ is closed to new replies.