Description
The gform_abilities_definitions filter is a bulk hook over the full list of ability definitions before registration. Use it to add your own, remove ones you never want registered, or adjust several at once.
Usage
The following would apply to all abilities.
add_filter( 'gform_abilities_definitions', 'your_function_name' );
| Parameter | Type | Description |
|---|---|---|
| $definitions | array | The full list of ability definitions to be registered. Each item is an array with name and args keys. Each item is array( 'name' => 'vendor/tool-name', 'args' => array( ... ) ). |
Examples
Remove an Ability.
// Remove an ability from the site entirely (it never registers).
add_filter( 'gform_abilities_definitions', function ( $definitions ) {
return array_values( array_filter( $definitions, function ( $def ) {
return 'gravityforms/entries-delete' !== $def['name'];
} ) );
} );
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