This is my version using @elliotcondon original code. It fires only on backend. Please add it to your functions.php on your needs.
<?php
class AutoActivator {
const ACTIVATION_KEY = 'youractivationkeyhere';
/**
* AutoActivator constructor.
* This will update the license field option on acf
* Works only on backend to not attack performance on frontend
*/
public function __construct() {
if (
function_exists( 'acf' ) &&
is_admin() &&
!acf_pro_get_license_key()
) {
acf_pro_update_license(self::ACTIVATION_KEY);
}
}
}
new AutoActivator();
?>