gform_preview_init

Description

The gform_preview_init action is triggered when the form preview page loads, allowing further actions to be done.

Usage

add_action( 'gform_preview_init', 'my_function' );

Parameters

ParameterTypeDescription
$form_idintThe current form ID

Examples

function my_function() {
    // Do something here
}
add_action( 'gform_preview_init', 'my_function' );

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 action hook was added in Gravity Forms 2.5. The $form_id parameter was added in Gravity Forms 2.9

Source Code

This action hook is located in preview.php.