Sync User Custom Fields with Audience Merge Fields

Sometimes your website users can have some meta data, it could be custom fields created manually, or added by plugins, for example Carbon Fields or ACF (Advanced Custom Fields).

And in some cases you would like this data to be synced with your Mailchimp audiences (lists).

In order to do so just click Setup button near the rule you would like to configure:

Though first_name and last_name fields are configured on this video, you do not need to do it, because these ones are synced by default with FNAME and LNAME Mailchimp merge tags.

There is also another way of configuring the user fields sync, using this filter hook:

add_filter( 'rudr_ms_merge_fields', 'your_function_name', 10, 2 );

function your_function_name( $merge_fields, $user_id ) {

	$merge_fields[ 'FIELD_NAME' ] = get_user_meta( $user_id, 'field_name', true );
	return $merge_fields


If you do not know where to insert the code, please check this guide.

How to get merge field name?

We have to specify a name of a merge field here – $merge_fields[ 'FIELD_NAME' ]. In order to do that, we first have to create it right? If you haven’t done it yet, please go to a specific audience you’re working with in your Mailchimp account, click Settings and then Audience fields and |MERGE| tags. Add a Field.

MailChimp Merge Fields
Be careful with making field required, in that case users without this custom field won’t be synced.

So, now we have to specify the merge tag like this $merge_fields[ 'MISHA_TEST' ] or like this $merge_fields[ 'MERGE1' ].

How to get user field name?

The last but not the least, we have to specify the user custom field name. How to do it – may vary depending on how it was added. The 100% working solution for any situation – is to find it in the database. In order to do that your have to open wp_usermeta table (wp_ prefix could be different for your website) and find the field there. We need the value of meta_key column. Let’s say, it is misha_test_field. In this case the 5th line of the code will look like:

$merge_fields[ 'MISHA_TEST' ] = get_user_meta( $userdata->ID, 'misha_test_field', true );

Of course, you can sync multiple custom fields just by duplicating this line. You don’t have to duplicate the whole code of course :)

Need more help?