Home Forums ACF PRO Pro License Key in config?


Pro License Key in config?

  • Here’s how I do it:

    I just define my license key in my wp-config. You may want to add/tweak the action hooks this is added to so it runs in your situation.

  • This is marked as solved, but I think what most people (including myself) are looking for is that this be built into the core.

  • I totally get that. Would be wonderful to see this land in ACF Core. That gist is a near complete solution that could be added to core with very minor tweaking.

  • @jacobdubail your solution is great and thank you for sharing your work! Hopefully that will help @elliot when it comes time (fingers crossed) to implement.

  • That gist actually doesn’t solve the problem for me. For example, ACF is already licensed on my staging site, but when I do a database pull from the production site, the URL no longer matches and the license is invalidated.

    A simple DEFINE in wp-config would be a better option in my case, I think!

  • +1 for being able to just set a config constant for the license key.

    I have a shell script that uses wp cli to setup (or tear down) my development environments quickly and efficiently. ACF is one of the standard plugins I include in that process. WP Migrate DB Pro as well. DelicousBrains allows you to simply define a constant in the config file for the plugin license key. This allows me to easily add that constant via wp cli when creating the environment.

    Needing to manually add the key for ACF is a step that would be nice to eliminate.

  • +1 from me.

    I also have to re-enter the license key several times a day on different sites because of this problem.
    Would be a huge time saver.

  • This reply has been marked as private.
  • +1 for way to autosave the license key. It’s frustrating I need to constantly re-enter. Also, this means my ManageWP plugin update service does not work via ManageWP, so I need to log into ACF sites and manually do the plugin update, which negates the benefit of a service like ManageWP.

  • I agree but until then the following code snippet can be applied to a batch of sites via ManageWP’s code snippet feature. Just add in your key and bulk apply to all sites.

     $save = array(
     'key' => "ACF_LICENSE_GOES_HERE",
     'url' => home_url()
     $save = maybe_serialize($save);
     $save = base64_encode($save);
     update_option('acf_pro_license', $save);
  • @anchordev Is that hooked into a filter somewhere so it isn’t run every time a page loads?

  • No it’s a one time run code which I deploy using: It has to be manually reapplied anytime the URLs change or the key get’s dropped for any other reason. Check out @jacobdubail comment for an example of how he uses it with an action hook. I got the idea from his code.

  • By the way, if this is being triggered by a WP Migrate DB Pro migration (as is the case for me), the following should prevent the key from being overwritten during a migration:

  • @anchordev Cool, I’ve never used ManageWP, that feature is new to me.

  • Nice! That wpmdb_preserved_options gist should do the trick for me 90% of the time, and that ManageWP snippet looks handy… and like @daltonmadebyraygun-com , I gotta explore that feature more.

    Still, placing the license key in the wp-config would be a nice way to set it and forget it at installation time.

  • Any updates on this?? I’d like to be able to define the license key in my client’s config file as well.

  • +1000 for this feature. This is a regular source of frustration since I cannot automate my ManageWP updates until there is a solution for defining the ACF license key in code. This is the only plugin that gives me problems, and I need to constantly go and manually update. Thanks for your consideration. 🙂

  • @elliot Any progress on this issue? It’s been marked as solved but it seems like a lot of people would love to see a solution to persistently store the ACF license key in a file.

  • +1 for a wp-config constant.

    I use ManageWP and I create my sites with script and wp-cli. Honestly, I’d pay an annual fee for this plugin every year. That’s how much I use and like it. But the lack of a constant is tough.

  • Also, it seems like @elliot changed something because that snippet from @jacobdubail stopped working for me. It still populates the field for me but ACF still acts like the key isn’t entered when I go to update. I then have to deactivate the license key and activate all over again. Then ACF will update.

    It’s like Elliot added a second value that the manual activation process creates in the DB and the plugin checks for before updating. Elliot, is there any possible way to do this and not violate what you’re trying to do with your plugin, business-wise? Or is that not an issue and I am just doing it wrong?

    Any one else run into this?

  • I may have run into this, at least on one site… I couldn’t get the ACF key to work any more with those snippets.

  • I’m quite disappointed that this is not solved, yet. I would also be happy to pay an annual fee for that and all the other awesome features of ACF.

  • FWIW, my answer that’s marked as the solution (even though it’s a workaround) has been fine deploying across multiple environments, including management with ManageWP, since ACF Pro 5 came out. There have been no issues.

    Hey peeps, here’s a quick fix to add a licence key on theme activation:

    It would be nice to have an official solution though.

  • @mattrad-8q962886d4 I’m pretty sure that’s the same snippet I’m using. It does work in the sense that the activation key is activated in the ACF backend, but ACF continues to act like it’s not when I update. I have to deactivate the key and reactivate it manually. It’s happening on all of my and my clients’ sites.

    It was working for a while though. Not sure what changed.

  • @jmay Wish I knew what the problem was but ¯\_(ツ)_/¯

    An official solution would be much appreciated.

Viewing 25 posts - 26 through 50 (of 105 total)

You must be logged in to reply to this topic.