Description
The gform_ability_definition filter is a per-definition hook that runs after the bulk filter, for each ability. Use it to adjust labels, descriptions, capabilities, or schemas.
Usage
add_filter( 'gform_ability_definition', 'your_function_name', 10, 2 );
Parameters
| Parameter | Type | Description |
|---|---|---|
| $definition | array | The ability definition being registered. |
| $name | string | The name of the ability, e.g. gravityforms/forms-delete. |
Examples
Require a Stricter Capability for Form Deletion.
// Require a stricter capability for form deletion.
add_filter( 'gform_ability_definition', function ( $definition, $name ) {
if ( 'gravityforms/forms-delete' === $name ) {
$definition['capability'] = 'manage_options';
}
return $definition;
}, 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 filter is located in gravityforms/includes/abilities/class-gf-abilities-registry.php
Since
The filter was added in Gravity Forms 3.1.0