Support

Account

Home Forums ACF PRO Pro License Key in config?

Solved

Pro License Key in config?

  • +1 to make some noise.

    It is really time consuming that any member of my team and I constantly have to re-enter the keys on all our computers for local development and on every dev, stage and prod environment after every single sync of the database.

  • +1 again, about time for this issue to be solved.

  • @elliot Are there any plans to deal with this issue?

  • Just here for my regular biennial bump!

    This topic was started in 2014 and I’ve been following it since at least 2016. Every few years there’s been some noise indicating this was being worked on, but here we are in nearly 2020 and it’s still not resolved.

    Like many other developers I regularly deploy updates to development, staging and production environments for numerous sites with ACF Pro installed. Each time I run a database migration (via WP Migrate DB Pro) I have to manually reactivate ACF Pro. I have yet to encounter another premium plugin that behaves similarly.


    @elliot
    , I love ACF and owe you a huge debt of gratitude for the time and effort you’ve saved me over the years! That said, this has been a pain point for a long time. Is there any possibility of this making it onto the roadmap for 2020?

  • +1 (again). @elliot, we chatted a few years ago, and you were interested in doing this and possibly spoke with others (Delicious Brains, Gravity maybe?) in how they do things. Can you at least give us an update whether this is going to happen?

    We all love ACF Pro. We just lose countless hours due to this issue that we don’t have with any other pro plugin.

  • @nlenkowski can you send Elliot a support request regarding this? That’s how I got a hold of him a few years back.

  • +1 can’t understand why this is marked as solved

  • @fletch Not a bad idea. I’ll give it a few weeks and reach out to him directly.

  • @nlenkowski Were you able to get that support request made? With the new Gravity-Forms-esque pricing tiers going into effect, it seems this is the perfect time to do something like this.

  • @jmay and @fletch I sent Elliot a support request via email on Feb 14 and heard back from him the next day.

    Elliot indicated he continues to be interested in implementing this feature, but needs to do additional research. His primary concern is license keys ending up accidentally checked into public GitHub repositories, a valid concern.

    He also said that once he’d made a decision on whether or not to implement this he’d reply directly on this topic.

  • wp-config.php already contains your database credentials, so I hope people aren’t checking that into public repos, but I guess you never know. ¯\_(ツ)_/¯

    In my other (non-WP) applications, I use a .env file for sensitive info that doesn’t get checked into version control. I wish WP supported it natively, but here’s a quick tutorial on how to use it: https://m.dotdev.co/secure-your-wordpress-config-with-dotenv-d939fcb06e24

    Easy enough if you control the server and can use Composer, otherwise probably not an option.

  • While it is probably possible that some wp-config files might go public, it is a risk that premium plugins like Gravity Forms, WP Migrate DB Pro and Admin Columns Pro are willing to take, and have been for quite a while.

  • Mine own eyes have seen wp-config.php (as well as other sensitive credentials and API keys) checked into public repositories, unfortunately. It would be great if WP supported .env files natively, it’s definitely the proper place for config values. Too bad it’s not an option, it would likely alleviate this concern for many developers.

  • I don’t see the wp-config concern as enough of a reason to prevent this given how many other plugins and values such as DB credentials are already following that pattern.

    It would be great if WP supported .env files natively, it’s definitely the proper place for config values.

    Agreed. Until that is part of core, using https://github.com/vlucas/phpdotenv isn’t that much overhead as an included composer package. The roots.io team has a good write-up of how they’ve incorporated into their repo structures, build pipelines, etc. But chances are if wp-config has been committed with values to git, adding a composer dependency may be beyond the same user base :/

  • Hey – what’s up 2014 feature request? 😎
    +1 from me
    still seems like this would be super helpful to a lot of people.

  • Maybe a solution could be to use the acf_pro_update_license($key) function ? You can place it in a PHP script that you can call with the wp-cli if you want to do a centralized deployment of the license key across multiple websites. That’s what I plan to do for all our websites, I can notify the community here if it worked for me and some people are interested.

  • @ccnweb This feature request has been stalled for quite some time. If you put together a workable solution it would be great if you shared it here. A custom wp-cli command would do nicely!

  • Throw this in your MU plugins https://gist.github.com/petertwise/eeb7dea2531ad204a346e42faba0179a#file-acf_pro_license_constant-php
    and then add put this in your wp-config file:
    define('ACF_PRO_LICENSE', 'yourkeyhere' );

    That can be used manually, but I also use this bash script to make it easier to install. Note that the license key is not stored in the script:
    https://gist.github.com/petertwise/eeb7dea2531ad204a346e42faba0179a#file-acf-install-license

    Please use responsibly. Never ever allow your key to become public. Never include wp-config or any files including licenses and other secrets in any version control system.

    It’s also important to double check that you are following [WP best practices and setting wp-config.php permissions](https://wordpress.org/support/article/changing-file-permissions/#shared-hosting-with-suexec) to 440 or 400 when you’re not editing the file.

  • I’m pleased to say that this has now been implemented as part of ACF PRO 5.11 🙌

    ACF will now look for and use a PHP constant named ACF_PRO_LICENSE, which you can define with your license key.

    define('ACF_PRO_LICENSE', 'yourkeyhere' );

    This can be done in the wp-config.php file or any other file that WordPress runs before it loads the ACF PRO plugin. For more details, check out our guide on how to activate the ACF PRO plugin.

  • @iainpoulson Thanks!

    “or any other file that WordPress runs before it loads the ACF PRO plugin”

    Be great to have documentation on that page about that implementation as well.

  • @iainpoulson Amazing – thanks for putting this feature into ACF Pro. The people have been asking for it in this thread for 7 years and now it’s finally here!

    An extra special thank you for keeping the same constant name. We were using our little drop in plugin on dozens of client sites and now we can just delete the mu-plugin and move on instead of having to edit wp-config on every site.


    @madebytincans
    “or any other file that WordPress runs before it loads the ACF PRO plugin” – I guess they are saying you could technically put the constant in other files that load earlier – but I think most of those files would be something you would want to keep under version control, which would not be a good place to keep your license key. I think the danger of that happening is probably the reason Elliot never implemented this for so many years. Probably best to use wp-config.php unless you have a really special use-case or setup.

  • @madebytincans Yes, exactly like @squarecandy says. Putting it somewhere other than wp-config.php would be specific to each setup, eg. using .env files with Bedrock.

  • Wow! Almost 7 years to the day. Pretty wild. This has been a fun thread to watch over the years.

Viewing 25 posts - 76 through 100 (of 105 total)

The topic ‘Pro License Key in config?’ is closed to new replies.