How to Get MailChimp Auto Subscription upon User Registration

The most popular email marketing platform MailChimp provides many useful features to perform marketing campaigns and send newsletters by creating subscribers’ list. In this article, we will describe the method of auto subscription upon user registration for a WordPress website.

Action hooks are provided by WordPress to attach a custom function with wp functions and then WordPress perform tasks on different actions. For user registration action, user_register hook provided by WordPress has been used. You need to attach the pt_mailchimp_subscribe function with user_register hook. This will send a subscription request to MailChimp upon successful registration of the user.

pt_mailchimp_subscribe function requires a User ID sent by action hook on its call inside wp_insert_user function. You need to get MailChimp API Key and Subscribers List ID to enter in pt_mailchimp_subscribe function’s code.

Now, add the following code in Theme‘s functions.php file or you can use it for any custom plugin:

User Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Get in Touch