Support

Account

Home Forums ACF PRO Activation Code in theme code

Solved

Activation Code in theme code

  • Hi there, I work a lot with local development, from time to time mirroring the database of the online website to the local install. Every time I do that, I have to re-enter the activation code for ACF, which gets kind of annoying.

    Is there any way to include the activation code in my theme’s source code?

  • This is all just guess work.

    Look at the values in the database that ACF uses. Options table, option_name = ‘acf_pro_license’

    add an action as early as possible, I’m not sure how early you need to do this but it needs to be before ACF gets the value. Even then I don’t know if it will work because the option is auto loaded.

    
    // this is the function to call in add_action()
    function update_my_acf_license() {
      update_option('acf_pro_license', 'value from DB', true);
    }
    
  • Hi John, thanks for your answer!

    I checked this table entry, but it doesn’t match my activation code. It seems to be somehow encoded (my guess is like a password, md5)…

    I will dig a little deeper, maybe I can find something.

  • I would just copy the value straight out of the database, insert that value and see if it works. The actual value is an array that is serialized and base 64 encoded. /advanced-custom-fields-pro/pro/api/api-pro.php line 353.

    Hoestly, if you are updating ACF on one site and then mirroring it to another site then there’s really no reason to have it activated on both sites. The only thing that activation gets you us updates, so you only need it it activated on the site where you’re doing updates.

  • Hi John, actually I worked it out 🙂 This is what I did:

    
    function my_update_acf_license() {
      acf_pro_update_license( 'xxxxxxxxxxxxxx' );
    }
    add_action('init', 'my_update_acf_license');
    

    I think it’s no problem since the theme I’m working on will not be sold as a premium theme, so the code won’t be publicized. Thanks for your hint!

Viewing 5 posts - 1 through 5 (of 5 total)

The topic ‘Activation Code in theme code’ is closed to new replies.