I have little problem with finishing my WordPress plugin. Basically, what it does is a simple form made for Mailchimp subscription.
It successfully subscribe email to the list when API key is stored in variable directly (case 1). However, when I want to load API key from options using get_options (case 2), it just doesn’t work. I tried almost everything and I’m little desperate about it.
CASE 1 – works great
$api_key = "4085990a9f0816b54729ac1937d1dbb1-us5";
require('includes/Mailchimp.php');
$Mailchimp = new Mailchimp( $api_key );
$Mailchimp_Lists = new Mailchimp_Lists( $Mailchimp );
$subscriber = $Mailchimp_Lists->subscribe( $list_id, array( 'email' => htmlentities($_POST['email']) ), $merge_vars, $email_type, $double_optin, $update_existing, $replace_interests, $send_welcome );
CASE 2 – email is not subscribed
$api_key = get_option( 'mcvce_apikey' );
require('includes/Mailchimp.php');
$Mailchimp = new Mailchimp( $api_key );
$Mailchimp_Lists = new Mailchimp_Lists( $Mailchimp );
$subscriber = $Mailchimp_Lists->subscribe( $list_id, array( 'email' => htmlentities($_POST['email']) ), $merge_vars, $email_type, $double_optin, $update_existing, $replace_interests, $send_welcome );
Thanks for your help.
Vaclav