gform_abilities_init

Description

The gform_abilities_init action fires after all core Gravity Forms abilities are registered. It is a safe moment for add-ons or site code to register their own via wp_register_ability().

Note: Abilities with an unregistered category fall back to the add-ons category rather than being dropped.

Usage

add_action( 'gform_abilities_init', 'your_function_name' );

Parameters

This action does not pass any parameters.

Examples

Register a Custom Ability.

add_action( 'gform_abilities_init', function () {
	wp_register_ability( 'gravityforms-myaddon/sync-crm', array(
		'label'            => __( 'Sync to CRM', 'my-addon' ),
		'description'      => __( 'Pushes an entry to the CRM.', 'my-addon' ),
		'category'         => 'gravityforms-addons',
		'capability'       => 'gravityforms_edit_entries',
		'execute_callback' => 'my_addon_sync_entry',
	) );
} );

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-abilities-service-provider.php

Since

The action was added in Gravity Forms 3.1.0