gform_before_execute_ability

Description

The gform_before_execute_ability action fires just before a tool runs (permission check already passed) which can’t block or change anything.

Usage

add_action( 'gform_before_execute_ability', 'your_function_name', 10, 3 );

Parameters

ParameterTypeDescription
$ability_namestringThe name of the ability about to be executed.
$inputarrayThe input parameters being passed to the ability.
$abilityobjectThe ability object about to be executed.

Examples

Log ability execution.

add_action( 'gform_before_execute_ability', function ( $ability_name, $input, $ability ) {
    // Log every ability that passes the permission check.
    GFCommon::log_debug( "Executing ability: {$ability_name}" );

    // Optional: react only when a specific ability runs.
    if ( 'gravityforms/entries-delete' === $ability_name ) {
        GFCommon::log_debug(
            sprintf(
                'About to delete entry ID %s',
                rgar( $input, 'entry_id' )
            )
        );
    }
}, 10, 3 );

Source Code

This action is located in gravityforms/includes/abilities/class-gf-ability.php

Since

The action was added in