Skip to content

Instantly share code, notes, and snippets.

@jacobdubail
Created January 30, 2017 23:44
Show Gist options
  • Save jacobdubail/d5b5e76e6daca8a3258518fe710ed102 to your computer and use it in GitHub Desktop.
Save jacobdubail/d5b5e76e6daca8a3258518fe710ed102 to your computer and use it in GitHub Desktop.
Function to auto-set your ACF5 Pro license key
function jtd_acf_auto_set_license_keys() {
if ( !get_option('acf_pro_license') && defined('ACF_5_KEY') ) {
$save = array(
'key' => ACF_5_KEY,
'url' => home_url()
);
$save = maybe_serialize($save);
$save = base64_encode($save);
update_option('acf_pro_license', $save);
}
}
add_action('after_switch_theme', 'jtd_acf_auto_set_license_keys');
// you may want to add additional actions here.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment