Description
This filter hook allows you to change the MailChimp mail merge fields (if you are using any). The default in the add-on are first name and last name from the default first and last name fields. If you have changed those fields, or want to use different fields for other merge values, you can do it with this filter.
Usage
add_filter( 'wpmem_mc_merge', 'my_mc_merge_filter' ); function my_mc_merge_filter( $merge_vars ) { /* * The default merge_vars, first and last name come in * with the $merge_vars array. If you are adding to * the merge fields IN ADDITION TO those, you'll need * to consider that as you filter the array. * * Here is an example where I keep the existing merge * fields (first and last name) and add two additional * fields to that array. Note how I obtain the values * from the posted form data. */ $my_new_field = array( 'MC_MERGE_FIELD_1' => $_POST['wp-members-field-meta-key-1'], 'MC_MERGE_FIELD_2' => $_POST['wp-members-field-meta-key-2'], ); $my_new_merge = array_merge( $merge_vars, $my_new_field ); return $my_new_merge; }
Changelog
- 1.0.0 Introduced
- 2.0.0 Moved to object class method do_subcribe()
- 2.0.1 Moved to get_merge_fields()
Source
wpmem_mc_merge is located in includes/class-wp-members-mailchimp.php