gform_delete_field_link

Description

The gform_delete_field_link filter allows for modification of a form field delete link. This will change the link for all fields.

Usage

add_filter( 'gform_delete_field_link', 'your_function_name' );

Parameters

VariableTypeDescription
$delete_field_linkstringThe Delete Field Link (in HTML)

Examples

Remove delete action for non-admin users.

The following example effectively removes the delete field action button for all non-administrator users on the site.

add_filter( 'gform_delete_field_link', function( $link ) {
    return current_user_can( 'manage_options' ) ? $link : '';
} );

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 hook is located in includes/fields/class-gf-field.php.