Skip to content

Instantly share code, notes, and snippets.

@growdev
Created May 22, 2017 16:30
Show Gist options
  • Save growdev/4740efd3c45b547a2ebb0bd48a0586a6 to your computer and use it in GitHub Desktop.
Save growdev/4740efd3c45b547a2ebb0bd48a0586a6 to your computer and use it in GitHub Desktop.
Setup CK API and Subscribe customer to Form
<?php
$options = get_option( '_wp_convertkit_settings' );
$api_key = $options && array_key_exists( 'api_key', $options) ? $options['api_key'] : null;
$api_secret = $options && array_key_exists( 'api_secret', $ptions) ? $options['api_secret'] : null;
$debug = $options && array_key_exists( 'debug', $options) ? $options['debug'] : null;
$api = new ConvertKitAPI( $api_key,$api_secret,$debug );
$form_id = '11111';
$name = 'Test Test';
$email = 'test@test.com';
$api->form_subscribe( $form_id, array( 'email' => $email, 'name' => $name ) );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment