gform_form_trash_link

Description

This filter is no longer available since Gravity Forms 2.5.

Allows for modification of the Form Trash Link on the Form Editor page.

Note: Replaced the deprecated gform_form_delete_link filter.

Usage

add_filter( 'gform_form_trash_link', 'your_function_name', 10, 2 );

Parameters

  • $trash_link string
    The Trash link HTML.
  • $form_id int
    The ID of the form being edited.

Examples

add_filter( 'gform_form_trash_link', 'rename_trash_link', 10, 2 );
function rename_trash_link( $trash_link, $form_id ){
    $trash_link = str_replace( 'Move to Trash', 'Remove this Form', $trash_link );
    return $trash_link;
}

2. Prevent a specific Form from being deleted

add_filter( 'gform_form_trash_link', 'prevent_form_deletion', 10, 2 );
function prevent_form_deletion( $trash_link, $form_id ){
    if ( $form_id == 75 ) {
        $trash_link = '<a class="submitdelete" onclick="alert(\'This form cannot be deleted.\');" onkeypress="alert(\'This form cannot be deleted.\')">Remove this Form</a>';
    }
    return $trash_link;
}

Placement

This code should be placed in the functions.php file of your active theme.

Since

This filter was added in Gravity Forms version 1.8.
Added the $form_id param in version 2.1.2.3.

Source Code

This filter is located in GFFormDetail::forms_page() in form_detail.php.