The “gform_mailchimp_subscription” filter in Gravity Forms Mailchimp Add-On modifies the subscription object before it is executed.


add_filter( 'gform_mailchimp_subscription', 'my_function', 10, 6 );


  • $subscription array
    Subscription arguments. See the Mailchimp API documentation for a full list of supported properties.
  • $list_id string
    Mailchimp list ID.
  • $form array
    The form object.
  • $entry array
    The entry object.
  • $feed array
    The feed object.
  • $member array
    The existing member object. False if member does not currently exist in Mailchimp.


1. If a subscriber already exists, set them as subscribed

Doing this will avoid the double opt-in for existing members.

add_filter( 'gform_mailchimp_subscription', 'update_existing', 10, 6 );

function update_existing( $subscription, $list_id, $form, $entry, $feed, $member ) {
    if ( $member ) {
        $subscription['status'] = 'subscribed';

    return $subscription;

2. Set the signup timestamp

add_filter( 'gform_mailchimp_subscription', function( $subscription, $list_id, $form, $entry, $feed, $member ) {
    if ( ! $member ) {
        $subscription['timestamp_signup'] = date( DATE_ATOM );

    return $subscription;
}, 10, 6 );

3. Set the Subscriber language

The following example uses the ICL_LANGUAGE_CODE constant provided by the WPML plugin to set the subscriber language.

add_filter( 'gform_mailchimp_subscription', 'gf_set_subscriber_language' );
function gf_set_subscriber_language( $subscription ) {
	GFCommon::log_debug( __METHOD__ . '(): running.' );
	// Use the language code provided by WPML to set the subscriber language.
	if ( defined( 'ICL_LANGUAGE_CODE' ) ) {
		GFCommon::log_debug( __METHOD__ . '(): Setting value for ICL_LANGUAGE_CODE as subscriber language: ' . ICL_LANGUAGE_CODE );
		$subscription['language'] = ICL_LANGUAGE_CODE;

	return $subscription;

4. Change email_type to text from the default HTML

add_filter( 'gform_mailchimp_subscription', function( $subscription, $list_id, $form, $entry, $feed, $member ) {
	// this will force all subscriptions to text format
	$subscription['email_type'] = 'text';
	return $subscription;
}, 10, 6 );


Added existing member object as $member parameter in 4.1.9.


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 includes/addon/class-gf-mailchimp.php.