FGF-College-Work / Forum

:beer: Espaço dedicado a discussões e tira dúvida sobre disciplinas e conteúdo tecnológico.
MIT License
13 stars 4 forks source link

licence activation.php #223

Open marcialwushu opened 4 years ago

marcialwushu commented 4 years ago

ACF5 Pro licence activation. Could be adapted for any other plugin that requires a licence key, but doesn't yet support defining it in wp-config. Fires on theme activation.

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

// Set ACF 5 license key on theme activation. Stick in your functions.php or equivalent.
function 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', 'auto_set_license_keys' );
marcialwushu commented 4 years ago

https://gist.github.com/mattradford/6d5b8f3cd11ce1f62480

marcialwushu commented 4 years ago

https://guide.the7.io/user-guide/installation-and-basic-setup/

marcialwushu commented 4 years ago

https://support.advancedcustomfields.com/forums/topic/pro-license-key-in-config/