gform_html_message_template_pre_send_email

Description

The gform_html_message_template_pre_send_email filter allows the HTML-formatted message template to be overridden.

Usage

The following would apply to all forms.

add_filter( 'gform_html_message_template_pre_send_email', 'your_function_name' );

Parameters

ParameterTypeDescription
$templatestringThe template for the html formatted message. Use {message} and {subject} as placeholders.

Examples

Override the HTML Message Template

This example overrides the default HTML message template with a custom one.

add_filter( 'gform_html_message_template_pre_send_email', 'notification_template' );

function notification_template( $template ) {
	$template = '
		
			
				{subject}
			
			
				{message}
			
		';

	return $template;
}

Placement

This code can be used in the functions.php file of the active theme, a custom functions plugin, a custom add-on, or with a code snippets plugin.

See also the PHP section in this article: Where Do I Put This Code?

Source Code

This filter is located in common.php.