Skip to content

Commit

Permalink
Merge pull request #146 from kimcoleman/dev
Browse files Browse the repository at this point in the history
Ensuring the API key has a hyphen before exploding to prevent errors
  • Loading branch information
kimcoleman authored Sep 24, 2024
2 parents 38315b9 + bf934dc commit 39153bc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion classes/class-pmpromc-mailchimp-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ public function __construct($api_key = null) {
);

// the datacenter that the key belongs to.
list(, self::$dc) = explode('-', $api_key);
if ( strpos( self::$api_key, '-' ) != false ) {
list(, self::$dc) = explode('-', self::$api_key);
}

// Build the URL based on the datacenter
self::$api_url = "https://" . self::$dc . ".api.mailchimp.com/3.0";
Expand Down

0 comments on commit 39153bc

Please sign in to comment.