Last active
December 12, 2019 19:10
-
-
Save campusboy87/fbf4c74d70b3453253b1c1e741a51350 to your computer and use it in GitHub Desktop.
Automatic activation of ACF license via PHP. The code adds the key to the option in the desired format, and adds the domain to the list of trusted domains tracked in the ACF profile, so that the update is successful. The code can be used as a MU plugin, a regular plugin, or inserted into the theme code.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'acf/init', 'set_acf_pro_license' ); | |
function set_acf_pro_license() { | |
global $acf_instances; | |
if ( isset( $acf_instances['ACF_Admin_Updates'] ) && ! get_option( 'acf_pro_license' ) ) { | |
/** | |
* @var ACF_Admin_Updates $acf | |
*/ | |
$acf = $acf_instances['ACF_Admin_Updates']; | |
$_POST['acf_pro_licence'] = 'YOUR_LICENCE_KEY'; | |
$acf->activate_pro_licence(); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment