gform_sanitize_confirmation_message

Description

The “gform_sanitize_confirmation_message” filter in Gravity Forms is used to sanitize the complete confirmation message just before outputting to the page. All scripts will be removed.

By the time the confirmation is displayed all the field values have been sanitized. However, there may be situations which require and additional level of sanitization. For example, this filter is useful if you’re using merge tags as values for HTML attributes.

Usage

add_filter( 'gform_sanitize_confirmation_message', 'your_function_name' );

Parameters

  • $sanitize_confirmation_message bool

    Indicates if the confirmation message should be sanitized. Default: false.

Examples

Turn on sanitization

add_filter( 'gform_sanitize_confirmation_message', '__return_true' );

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?

Since

This filter was added in Gravity Forms 2.0.

Source Code

This filter is located in GFCommon::maybe_sanitize_confirmation_message() in common.php.