Description
The gform_kit_subscriber_state filter modifies the subscriber state when adding a new subscriber to Kit. By default, new subscribers are set to “active”.
Usage
add_filter( 'gform_kit_subscriber_state', 'your_function_name', 10, 4 );
Parameters
| Name | Type | Description |
|---|---|---|
| $state | string | The default subscriber state. Available states:active (Default)bouncedcancelledcomplainedinactive |
| string | The subscriber’s email address. | |
| $name | string | The subscriber’s name. |
| $fields | array | An associative array of additional field data being submitted to Kit. |
Examples
Mark @example.com emails as inactive.
add_filter( 'gform_kit_subscriber_state', function( $state, $email ) {
// Mark example emails as inactive.
if ( str_ends_with( $email, '@example.com' ) ) {
return 'inactive';
}
return $state;
}, 10, 2 );
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?
Since
Added in Gravity Forms Kit Add-On v2.0.0.
Source Code
This filter is located in includes/class-gf-convertkit.php.