Set Outbound IP Address in CURL API Request for MailChimp WordPress Plugin

Category : WordPress

Facing issue with your default assigned IP for plugins like MailChimp for WordPress? This could be due to the blacklist of IP which is used when sending API requests. and MailChimp servers reject the request. This issue persists even if any cPanel Account is assigned with a Dedicated IP and API requests are sent from shared IP Address.

Today we will show how we can use another IP assigned to cPanel Account or Server.


  • cPanel Access or FTP Access to edit WordPress files.


  1. Login to cPanel and go to WordPress Website’s root directory using cPanel File Manager
  2. Open WordPress functions.php using edit option.
    Path of file /wp-includes/functions.php
    cpanel file manager edit file
  3. Add the following lines of code after <?php
    add_action('http_api_curl', function( $handle ){
    curl_setopt( $handle, CURLOPT_INTERFACE, '' );
    }, 10);
    Replace with your new IP or the IP you want to use for API requests.
    curl code
  4. Alternatively, you can also add the above lines of code in your current active themes folder or child theme folder if available.
    Path: /wp-content/themes/twentyfifteen/functions.php
    twentyfifteen is current active theme directory here
  5. After adding this code your MailChimp API will show connected status.

Similarly, if your other plugins are using CURL for API requests then this method can be implemented.