gform_mailchimp_keep_existing_groups

Description

Use this filter to modify whether a user that is already subscribed to your list has their groups replaced when submitting the form a second time. By default, the original groups are kept and any new ones are added.

Usage

add_filter( 'gform_mailchimp_keep_existing_groups', '__return_false' );

You can also specify this per form by adding the form id after the hook name.

add_filter( 'gform_mailchimp_keep_existing_groups_1', '__return_false' );

Parameters

There are no parameters.

Examples

Replace existing groups.

This examples returns false so that the groups are replaced.

add_filter( 'gform_mailchimp_keep_existing_groups', '__return_false' );

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 filter is located in class-gf-mailchimp.php.