How it Works
For users running Paid Memberships Pro: Allows admin to set which audience each level should be subscribed to. Note that this plugin works without PMPro as well. The integration requires a Mailchimp account, so if you do not have an account you can sign up here.
- Install the Add On via the Plugins > Add New in the WordPress dashboard. Or, upload the
pmpro-mailchimpdirectory to the
/wp-content/plugins/directory of your site.
- Activate the plugin through the ‘Plugins’ menu in WordPress.
- Navigate to Settings > PMPro Mailchimp to configure your Mailchimp API Key and Audiences.
Locating your Mailchimp API Key
- Log in to your account at Mailchimp.
- Click your profile name in the bottom left corner to expand the Account Panel, and choose Account.
- Click the Extras dropdown menu and choose API keys.
- Copy an existing API key or click the Create A Key button.
- Name your key so you will know what application uses that key.
- Copy and paste your Mailchimp API key into the “Mailchimp API Key” field under Settings > PMPro Mailchimp.
Below is a description of the various settings available in the plugin. Navigate to Settings > PMPro Mailchimp in the WordPress admin to configure the plugin for your site.
- Mailchimp API Key: Used to connect your website to Mailchimp. Follow the instructions in “Locating your Mailchimp API Key” to for more information.
- Non-member Audiences: These are the audiences that users will be added to if they do not have a membership level. They will also be removed from these audiences when they gain a membership level (assuming the audiences are not also set in the “Membership Levels and Audiences” option for their new level)
- Opt-in Audiences: These are the audiences that users will have the option to subscribe to during the PMPro checkout process. Users are later able to update their choice from their profile. Audiences set as Opt-in Audiences should not also be set as a Non-member Audience nor a Level Audience.
- Require Double Opt-in?: If set to “Yes (All audiences)”, users will be set to “Pending” status in Mailchimp when they are added to an audience instead of being subscribed right away. They will then receive an email from Mailchimp to opt-in to the audience.
- Unsubscribe on Level Change?: If set to “No”, users will not be automatically unsubscribed from any audiences when they lose a membership level. If set to “Yes (Only old level audiences.)”, users will be unsubscribed from any level audiences they are subscribed to when they lose that level, assuming that audience is not a Non-Member audience as well. If set to “Yes (Old level and opt-in audiences.)”, users will also be unsubscribed from opt-in audiences when they lose their membership level (though they can re-subscribe by updating the setting on their profile).
- Update on Profile Save If set to “Yes”, PMPro will update Mailchimp audiences whenever a user’s profile page is saved. If set to “No”, PMPro will only update Mailchimp when a user’s membership level is changed, email is changed, or chosen opt-in audiences are changed.
- Membership Levels and Audiences: These are the audiences that users will automatically be subscribed to when they receive a membership level.
Action and Filter Hooks
Below are the most commonly used action and filter hooks.
apply_filters( 'pmpro_mailchimp_merge_fields', array $merge_fields, string $audience_id );
Creates merge fields inside Mailchimp. Should be done for any fields that are added with
pmpro_mailchimp_listsubscribe_fields so that the fields are automatically created.
apply_filters( 'pmpro_mailchimp_listsubscribe_fields', array $merge_fields, WP_User $user, string $audience );
Send additional merge fields to Mailchimp. This article demonstrates how to use the ‘pmpro_mailchimp_listsubscribe_fields’ filter to send additional profile fields to Mailchimp.
apply_filters( 'pmpromc_disable_automatic_additional_audiences_updates', bool $disabled );
Stops Mailchimp from updating subscription status for opt-in lists automatically. Disabling may help site performance.
apply_filters( 'pmpromc_profile_update', bool $update, int $user_id, WP_User $old_user );
Overwrites the “Update on Level Save” setting. Should be phased out eventually in favor of the setting, but we’ve included it here since it is used in a lot of the code recipes we previously shared.
CSV Export Filters
The two filters linked below are part of core Paid Memberships Pro and are used within the MailChimp Add On for export-related adjustments.
apply_filters( 'pmpro_set_max_user_per_export_loop', int $max_users );
Sets max number of users exported at a time during CSV export. For information on this filter, see: https://www.paidmembershipspro.com/hook/pmpro_set_max_user_per_export_loop/
apply_filters( 'pmpro_memberslist_csv_dateformat', string $format );
Sets date format used during CSV export. For information on this filter, see: https://www.paidmembershipspro.com/hook/pmpro_memberslist_csv_dateformat/
Rarely Used Action and Filter Hooks
The action and filter hooks below are included in the Mailchimp Add On for Paid Memberships Pro but primarily only used for internal functions. It is unlikely that you will need to leverage this hooks.
apply_filters( 'pmpro_addon_mc_api_timeout', int $timeout );
apply_filters( 'pmpro_addon_api_timeout', int $timeout );
apply_filters( 'pmpro_addon_mc_api_fetch_list_limit', int $limit );
apply_filters( 'get_mailchimpapi_class_instance', PMPromc_Mailchimp_API $api );
do_action( 'pmpromc_get_api_failed', PMPromc_Mailchimp_API $api );
Screenshot of General Settings for the Mailchimp Add On for Paid Memberships Pro
Screenshot of Membership Levels and Audience Settings for the Mailchimp Add On for Paid Memberships Pro