1. Home
  2. Snippets
  3. Include Page Break, Section Divider, and HTML fields in notification emails

Include Page Break, Section Divider, and HTML fields in notification emails

Heads up!

This article contains PHP code and is intended for developers. We offer this code as a courtesy, but don't provide support for code customizations or 3rd party development.

Dismiss

Automatic notification emails for WPForms will, by default, include the {all_fields} Smart Tag. This will display all input fields (field labels and selections/input) that a user filled out.

To also include non-input fields (Page Break, Section Divider, and HTML fields), you can add the code below to your site. However, it’s important to note that some content will not display properly in emails (this will vary based on the specific content, as well as the email provider used to view the email). Due to the issues that can result from HTML content, we recommend only including the fields you absolutely need in notification emails.

We’ve included two examples, depending on which fields you need to include. Also, be sure to test your notification emails after adding this code.

Include only Page Break and Section Divider fields:

/**
* Include Page Break and Section Divider fields in form notification emails
*/
add_filter( 'wpforms_email_display_other_fields', function() {
	return array( 'divider', 'pagebreak' );
} );

 

Include all non-input fields (Page Break, Section Divider, and HTML fields):

/**
* Include Page Break, Section Divider, and HTML fields in form notification emails
*/
add_filter( 'wpforms_email_display_other_fields', function() {
	return array( 'divider', 'pagebreak', 'html' );
} );

 

Below, you can view a screenshot from part of an email where each of these non-input fields were included. For this example, each non-input field has been labeled to clearly note what field type is being shown.

Example of HTML output in notification email

Related

Updated on May 14, 2018

Was this article helpful?