Skip to content

Instantly share code, notes, and snippets.

@polevaultweb
Last active March 22, 2023 03:06
Show Gist options
  • Star 18 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • 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' );
@sasqik
Copy link

sasqik commented Mar 14, 2020

// Place this in wp-config
define('ACF_PRO_LICENSE', 'yourkeyhere' );

@petertwise
Copy link

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