Home Forums ACF PRO Pro License Key in config?


Pro License Key in config?

  • +1

    @elliot Will this ever be a feature you plan on working on?

    • philby

    • November 21, 2017 at 8:56 am

    Just re-entered ACF licenses in a bevy of sites after doing Migrate DB updates. Having this solved in an official way, like Gravity Forms (and Migrate DB Pro), would be really nice.

  • +1 Not sure why this is marked as solved but would be great. Especially for a multisite.

  • Yes this is still wanted. Recently had another large batch of websites lose their license keys. The custom code I previously used to reapply license keys stopped working. I assume something changed with the way ACF Pro activate license keys. I was able to get working by updating the custom code to match the code within ACF Pro itself.

    // Check if ACF is running
    if ( is_plugin_active( 'advanced-custom-fields-pro/acf.php' ) ) {
      // Loads ACF plugin
      include_once( ABSPATH . 'wp-content/plugins/advanced-custom-fields-pro/acf.php');
      // connect
      $post = array(
        'acf_license'	=> "ACF_PRO_KEY",
        'acf_version'	=> acf_get_setting('version'),
        'wp_name'			=> get_bloginfo('name'),
        'wp_url'			=> home_url(),
        'wp_version'	=> get_bloginfo('version'),
        'wp_language'	=> get_bloginfo('language'),
        'wp_timezone'	=> get_option('timezone_string'),
      // connect
      $response = acf_updates()->request('v2/plugins/activate?p=pro', $post);
      // ensure response is expected JSON array (not string)
      if( is_string($response) ) {
        $response = new WP_Error( 'server_error', esc_html($response) );
      // success
      if( $response['status'] == 1 ) {
        acf_pro_update_license( $response['license'] ); // update license
      echo $response['message']; // show message

    Also wrote some code to make this automatically update after using a WP-CLI search-replace command. That’s typically where I’m seeing the license keys drop.

  • Alternatively, you could use WP CLI to do this, if it suits your workflow:

    wp eval 'acf_pro_update_license("YOUR_KEY_HERE");'
    • Fletch

    • December 15, 2017 at 7:39 am

    I’ve submitted a support ticket calling attention to this feature request thread. Response back:

    I am going to pass the same to the developer for consideration. Hopefully such an option will find its way into the plugins development roadmap.

    Hopefully we can get this into the plugin and save everyone a lot of trouble.

    • Fletch

    • December 16, 2017 at 2:57 am

    Good news, @elliot responded and is looking for ideas to solve this license issue. Anyone have any ideas?

    “For sure, I can imagine the annoyance during the deployment stage.
    I haven’t been able to make much headway with this feature yet due to concerns of security.

    ACF uses the “Website URL” to help validate the activation. If I was to allow a “New URL” to modify an existing activation, this could allow someone to “share” a DB publicly that would allow new activations to be made.

    I’m sure there is a solution that will avoid this concern. If you have any ideas, I am very open to hearing them.”

    • apmeyer

    • December 16, 2017 at 3:01 am

    Yes, please do what Delicious Brains does for WP Migrate DB Pro. Allow us to set a constant in the wp-config file. See:

    • Mizner

    • January 7, 2018 at 9:33 am

    Just adding a vote of support for this. Have been watching this thread for years now.

    • Fletch

    • January 9, 2018 at 5:42 am

    I’ve been in touch with Elliot via support ticket, and he’s actively looking into this. He’s contacted Rocketgenius and perhaps Delicious Brains. He’s currently looking at setting it up the way WP Migrate DB Pro does it.

    I reckon changing the licensing method is not a quick fix, especially since it’s also a change in business practice.

    • JMay

    • January 9, 2018 at 7:10 pm

    That’s great news, Fletch! Thanks for updating us.

  • Great news!
    Thanks for the update @fletch. Looking forward to this feature.

  • Excellent news indeed, been looking forward to this for awhile. Thanks @fletch for the update and of course to @elliot for looking into it.

    • Mizner

    • April 12, 2018 at 4:40 am

    It’s been a few months, and this needs a bump. I’ve had multiple team members ask me (as the resident WP Evangelist) how to do this.

    Would really…. really love a WP Migrate DB PRO mimicked setup

    • Luca R.

    • April 26, 2018 at 7:54 pm

    Ok, since there’s still no update on this, I tackled the problem the other way around.

     * Preserve options on WP Migrate DB migrations.
     * @param  array $options 'option_name' in 'wp_options' table
     * @param  array $intent  (used by plugin when importing)
     * @return array
    function mytheme_wpmdb_preserved_options( $options, $intent = '' ) {
      $options[] = 'acf_pro_license';   // Advanced Custom Fields Pro License
      $options[] = 'cpupdate_cac-pro';  // Admin Columns Pro License
      return $options;
    add_filter( 'wpmdb_preserved_options', 'mytheme_wpmdb_preserved_options', 99, 2 );

    This preserves options when importing with WP Migrate DB. Tested on the Pro version, but it should work also with the free one. You can add the options for all the Pro plugins you use, given they store the key on the wp_options table.

    Hope this helps. Bye!

    • Fletch

    • May 2, 2018 at 6:27 am

    Darn, that didn’t work for me on Pro. I tried both in my theme functions and in a site specific plugin. I believe I recall something about this license being serialized as the recent this doesn’t work, but not sure.

  • It’s worth mentioning that the code above goes on the site where the DB is pulled/exported from (or best, on both sites).

    I’m saying this because the first time I put the code only on the destination site, then tried pulling, and it didn’t work.

    That said, I don’t know what the problem could be in your specific case. The filter is applied in get_preserved_options_queries() function, on wpmdb.php on line 1390 (WP Migrate DB Pro v1.8.1).

  • This is still needed in core 🙂

    For now, I’ve hooked into the pre_option_acf_pro_license filter:

    • kwaves

    • February 6, 2019 at 5:28 pm

    +1. If @elliot is concerned about security of storing one’s license key in the filesystem, here are some other ideas:

    Idea 1: Check site authorization remotely–no license key required after the first time. I think this would probably go hand-in-hand with letting folks authorize a site from (not just de-authorize). WPML does it that way. This also seems to be how Admin Columns Pro does it, since I never need to re-authorize that one after copying from one site to another, as long as I’ve authorized it once on that domain. If I remember correctly, I think WooCommerce extensions (and maybe WC itself) also takes that approach.

    Idea 2: Allow us to generate & hard-code site-specific auth tokens instead of the master license key. I don’t know what security issues @elliot is concerned about specifically (maybe that people’s license keys will start showing up on Github?) so maybe this is worthless, but if it helps get ideas going, perhaps there could be something similar to ACF’s current method of combining the license key and domain together, but instead of base64 it uses some kind of hashing algorithm. (On the other hand, perhaps doing that securely would entail the same logic/development required by idea 1 without any additional benefit?)

    • gilzow

    • February 13, 2019 at 4:40 am

    Add another +1 to this request.

  • I am currently using the hotfix by polevaultweb but I would really appreciate proper support.

    adding the constant to wp-config.php seems to be best practice. How to validate should make no difference for the “enduser”.

    If any changes on the license backend needs to be made I hope composer support is still considered. That is also a never ending topic. 🙁

  • Still no support on this, I’ll revive a 4 year old post to get some eyes on this… Currently it’s a nuisance to have to re-enter the license key every week or every time we migrate database, etc. Seems to “lose” the key entirely if anything updates it seems.

  • Thanks for the revival! The topic says solved because of a reply on the first page but I think we need a more official way of solving for this.

    If I work locally then upload the site to live or if I swap hosts it’s another thing I have to put on my checklist. For clients it’s a bigger deal because if they swap hosting after I’m out of the picture they can no longer get updates because of the license key.

    Would be a great feature to have.

    • lsell

    • July 20, 2019 at 10:17 am

    +1 on a 5 year old request…

    I maintain a multisite installation and several stand-alone sites, all of which exist on my local machine and in 2-3 environments for various layers of testing on the web, all of which are heavily reliant on ACF Pro, so I obviously have a developer license, and it’s a serious pain to have to manually copy in my key and reactivate on every environment every time I create a new subsite, change a url, refresh a testing environment, or even temporarily deactivate and reactivate the plugin while debugging something! I assumed using update_option(‘acf_pro_license’, [mylicense]) in my theme setup would help, but that doesn’t seem to be working, so I’m going to try the various suggestions throughout this thread and see if any get the job done, but SERIOUSLY this needs to be part of the core plugin.

    • Fouad

    • November 28, 2019 at 7:45 pm

    Definitely a +1 from us too. Our sites keep losing their licenses probably because o a a staging mechanism … so it is necessary to reenter our license on every update!

Viewing 25 posts - 51 through 75 (of 91 total)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.