gform_after_execute_ability

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

ParameterTypeDescription
$ability_namestringThe name of the ability that ran.
$inputarrayThe input parameters that were passed to the ability.
$resultmixedThe result of the execution. May be a WP_Error on failure.
$abilityobjectThe 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