Description
The gform_after_execute_ability action fires after a tool runs but only when the ability’s permission check passed.
Usage
add_action( 'gform_after_execute_ability', 'your_function_name', 10, 4 );
Parameters
| Parameter | Type | Description |
|---|---|---|
| $ability_name | string | The name of the ability that ran. |
| $input | array | The input parameters that were passed to the ability. |
| $result | mixed | The result of the execution. May be a WP_Error on failure. |
| $ability | object | The ability object that ran. |
Examples
Email Admin on Failure.
add_action( 'gform_after_execute_ability', function ( $name, $input, $result ) {
if ( is_wp_error( $result ) ) {
wp_mail( get_option( 'admin_email' ), 'GF ability failed', "$name: " . $result->get_error_message() );
}
}, 10, 3 );
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 is located in gravityforms/includes/abilities/class-gf-ability.php
Since
The action was added in Gravity Forms 3.1.0