Search code examples
wordpresssubscriptionmailing-list

subscribers in wordpress users and in external platform


is it possible for a wordpress subscription form to add subscribers in the wordpress user list and, at the same time, in a list on an external platform, such as mailchimp or activecampaign?

many thanks


Solution

  • It is possible to do it. However, you need to take into consideration the GDPR laws (and similar around the world). It is illegal to collect user data without consent.

    In WordPress you need to use user_register hook - which will fire right after user registers. The hook passes user ID and from there you can get the email address and subscribe the user to a mailing list via API call.

    add_action('user_register','my_function');
    
    function my_function($user_id){
      //do your stuff
    }
    

    Reference for MailChimp API: https://mailchimp.com/developer/guides/create-your-first-audience/