Skip to content

Instantly share code, notes, and snippets.

@polevaultweb
Last active March 22, 2023 03:06
Show Gist options
  • Save polevaultweb/9cdf1b3bfeb054f13f221d4612bd8901 to your computer and use it in GitHub Desktop.
Save polevaultweb/9cdf1b3bfeb054f13f221d4612bd8901 to your computer and use it in GitHub Desktop.
Define the Advanced Custom Fields Pro license key with a constant
<?php
function my_filter_acf_pro_license_option( $pre ) {
if ( ! defined( 'ACF_PRO_LICENSE' ) || empty( ACF_PRO_LICENSE ) ) {
return $pre;
}
$data = array(
'key' => ACF_PRO_LICENSE,
'url' => home_url(),
);
return base64_encode( serialize( $data ) );
}
add_filter( 'pre_option_acf_pro_license', 'my_filter_acf_pro_license_option' );
@petertwise
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment