gform_after_duplicate_form

Note: This hook has been deprecated and the hook gform_post_form_duplicated should be used instead.

Description

The gform_after_duplicate_form action in Gravity Forms is triggered after a form is duplicated, allowing further actions to be performed. The hook provides the ID of the form duplicated and the ID of the new form created.

Usage

add_action( 'gform_after_duplicate_form', 'my_function', 10, 2 );

Parameters

ParameterTypeDescription
$form_idstringID of the form being duplicated.
$new_idstringID of the new copy of the form.

Examples

Run a custom action after duplicating a form.

function my_function( $form_id, $new_id ) {
	echo 'Form ' . $form_id . ' was copied into ' . $new_id;
}
add_action( 'gform_after_duplicate_form', 'my_function', 10, 2 );

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 action hook is located in forms_model.php.