For developers who need to go beyond the settings page, the Mailchimp Integration offers several action and filter hooks. Use them to send more member data to Mailchimp, change when contacts are updated, move the API call log, and adjust how the Add On connects to Mailchimp.

Contact Data and Merge Fields

pmpro_mailchimp_listsubscribe_fields

Filters the merge fields sent to Mailchimp for a contact. Add a key and value to send another field. The Add On uses this filter at priority 10 to add PMPLEVELID, PMPALLIDS, and PMPLEVEL. Pair it with pmpro_mailchimp_merge_fields so the field is created in your audience. See Send Additional Fields to Mailchimp for an example.

The keys you return also become column headers in the CSV export for a Mailchimp import.

apply_filters( 'pmpro_mailchimp_listsubscribe_fields', array $fields, WP_User $user, string|null $audience );

Parameters

  • $fields: array; Merge field values as tag => value pairs. Default keys are FNAME and LNAME.
  • $user: WP_User; The user being sent to Mailchimp.
  • $audience: string|null; The Mailchimp audience ID. When a contact is queued for several audiences at once, the fields are built one time using the first audience ID. null during the CSV export.

pmpro_mailchimp_merge_fields

Filters the merge fields the Add On makes sure exist in an audience before it updates contacts. Any field that’s missing from the audience is created. This filter only runs when Paid Memberships Pro is active.

apply_filters( 'pmpro_mailchimp_merge_fields', array $merge_fields, string $list_id );

Parameters

  • $merge_fields: array; Fields to create. Each item is an array with name (the merge tag), type (a Mailchimp field type such as text or number), and optional public (bool, default false). An item can also be a plain string, which creates a text field with that tag. Default items are PMPLEVELID (number), PMPALLIDS (text), and PMPLEVEL (text).
  • $list_id: string; The Mailchimp audience ID.

pmpromc_user_data

Filters the full contact object sent to Mailchimp, after the merge fields are built. Use this to change the email address, status, or merge fields together, or to add other properties the Mailchimp API accepts for a member.

apply_filters( 'pmpromc_user_data', object $mc_user_data, WP_User $user );

Parameters

  • $mc_user_data: object; Contact data with the properties email_address, status (subscribed, pending, or unsubscribed), and merge_fields.
  • $user: WP_User; The user being sent to Mailchimp.

pmpromc_update_audience_members_data

Filters the request body sent to the Mailchimp API endpoint /lists/{audience_id} when the Add On adds, updates, or unsubscribes contacts in an audience. The Add On sends up to 500 contacts per request.

apply_filters( 'pmpromc_update_audience_members_data', object $data, string $audience );

Parameters

  • $data: object; Request body with members (an array of contact objects) and update_existing (true).
  • $audience: string; The Mailchimp audience ID being updated.

Sync Behavior

pmpromc_profile_update

Overwrites the “Update on Profile Save” setting. Return true to send the user’s data to Mailchimp when their profile is updated, or false to skip it, including when their email address changed. After a membership level change, the Add On hooks __return_true into this filter for the rest of that page load so profile changes made in the same request are also sent.

apply_filters( 'pmpromc_profile_update', bool $update_user, int $user_id, WP_User $old_user_data );

Parameters

  • $update_user: bool; Whether to update the user in Mailchimp. Default true if the email address changed or Update on Profile Save? is set to Yes, otherwise false.
  • $user_id: int; The ID of the user being updated.
  • $old_user_data: WP_User; The user’s data from before the update.

pmpromc_disable_automatic_additional_audiences_updates

Determines whether to skip checking Mailchimp for a user’s opt-in audience status. By default, the Add On asks Mailchimp for the user’s status in each opt-in audience when the checkout page or a profile form loads, and updates their saved choices to match. Return true to skip these requests. Opt-in checkboxes then show the choices saved in WordPress.

apply_filters( 'pmpromc_disable_automatic_additional_audiences_updates', bool $disable );

Parameters

  • $disable: bool; Whether to skip the status check. Default false.

Logging

pmpromc_log_path

Filters the full path of the API call log file. Use this to store the log outside your plugins folder.

apply_filters( 'pmpromc_log_path', string $pmpromc_log_path );

Parameters

  • $pmpromc_log_path: string; Full file path. Default is pmpromc-log- plus a random string and .txt in the Add On’s logs folder.

API Connection

Most sites never need these hooks. They control how the Add On connects to the Mailchimp API.

pmpromc_api_timeout

Filters how long, in seconds, the Add On waits for a response from the Mailchimp API.

apply_filters( 'pmpromc_api_timeout', int $timeout );

Parameters

  • $timeout: int; Timeout in seconds. Default 10.

pmpro_addon_mc_api_timeout

Filters the API timeout when the PMPromc_Mailchimp_API class is created with an API key passed to its constructor. The Add On creates the class without a key and sets the key afterward, so this filter doesn’t run in a standard setup. Use pmpromc_api_timeout instead.

apply_filters( 'pmpro_addon_mc_api_timeout', int $timeout );

Parameters

  • $timeout: int; Timeout in seconds. Default 10.

pmpro_addon_mc_api_fetch_list_limit

Filters the maximum number of audiences loaded from your Mailchimp account. Raise it if you have more than 15 audiences and some are missing from the settings page.

apply_filters( 'pmpro_addon_mc_api_fetch_list_limit', int $max_lists );

Parameters

  • $max_lists: int; Maximum number of audiences to load. Default 15.

get_mailchimpapi_class_instance

Filters the Mailchimp API object the Add On uses. The Add On’s PMPromc_Mailchimp_API class hooks into this filter to return its own instance. Return a compatible object to replace it.

apply_filters( 'get_mailchimpapi_class_instance', PMPromc_Mailchimp_API|null $api );

Parameters

  • $api: PMPromc_Mailchimp_API|null; The API object. The filter is applied to null, and the Add On’s class returns its instance.

pmpromc_get_api_failed

Fires when an API key is saved but the Add On can’t load the API object or connect to Mailchimp. Use it to log the failure or alert an administrator. It doesn’t fire when no API key is saved.

do_action( 'pmpromc_get_api_failed', PMPromc_Mailchimp_API|null $api );

Parameters

  • $api: PMPromc_Mailchimp_API|null; The API object that failed to connect, or null if no object was available.

CSV Export Filters

These filters run when you download a CSV from Settings > PMPro Mailchimp to import existing members into Mailchimp. The pmpro_memberslist_csv_dateformat filter has the same name as a filter in the Paid Memberships Pro Members List CSV export, so code you add for one also runs for the other.

pmpro_set_max_user_per_export_loop

Filters how many members are processed at a time while building the CSV file. Lower it if the export runs out of memory on a large site.

apply_filters( 'pmpro_set_max_user_per_export_loop', int $max_users_per_loop );

Parameters

  • $max_users_per_loop: int; Members processed per batch. Default 2000.

pmpro_memberslist_csv_dateformat

Filters the date format for the CSV export. The Mailchimp import file doesn’t include any date columns, so changing this value has no effect on the file today.

apply_filters( 'pmpro_memberslist_csv_dateformat', string $dateformat );

Parameters

  • $dateformat: string; A PHP date format. Default Y-m-d.

Last updated on November 13, 2026


Was this article helpful?
YesNo