Support

Account

Home Forums ACF PRO Pro License Key in config?

Solved

Pro License Key in config?

  • Hi,

    I migrate my database between local/staging/production environments at least once a week using WP Migrate DB Pro. Each time, I have to re-enter my license key to get updates. Is there a way I can hard code my license key in wp-config as a constant to prevent this?

    Thanks,
    Jacob

  • +1 for this.

    A lot of the premium plugins that I use have this feature. It’s really useful to be able to manage them all in one file on my clients’ websites.

  • +1 from me. This would be very useful.

    • Elliot

    • December 12, 2014 at 10:29 am

    Hi guys

    Thanks for the request. Can you provide a snippet from other plugins, I would liek to keep this consistent with everyone else.

    I’m guessing it is a constant in the wp-config.php file?

  • Hi @elliot Condon,

    Gravity Forms does it like this: define(“GF_LICENSE_KEY”, “YOUR-LICENSE-KEY-HERE”); http://www.gravityhelp.com/documentation/page/Advanced_Configuration_Options

    I’m not positive what the underlying code looks like. Do you need me to dig that up?

    Thanks!
    -Jacob

  • Hi @elliot,

    Yes, it’s defined in wp-config.php as a constant. I know Akismet has this baked in so you could probably find a working example by digging through the code of that plugin.

    Nice one!
    Mike

  • +1 for this one. I came here searching for this exact thing and came across this post. This isn’t a game changer, but would be very helpful.

    Thanks

  • Big +1 here as well, in my case for a MultiSite situation, do not want to have to enter the Pro key on every sub site. So a config file option would be great, or even a global setting on the network main site.

    Thanks!

  • Yeah, +1! This would speed up setting up new installations for my clients.

  • +1 This would be real handy.

  • Hi @elliot

    Any progress on this one?

    Thanks,
    Mike

    • nurelm

    • July 7, 2015 at 5:38 am

    Definitely interested in this as well.

    • agn1022

    • September 9, 2015 at 8:06 am

    Just looking for this…
    +1 – big time saver.

  • Hey peeps, here’s a quick fix to add a licence key on theme activation: https://gist.github.com/mattradford/6d5b8f3cd11ce1f62480

  • For anyone that tries to use this, you might check AFC’s comment first.

  • Elliot’s comment is perfectly valid if ACF is NOT being used in accordance with the licence. But there is nothing wrong with using this as a time-saver for development – adding a licence key defined in wp-config is something that other premium plugins such as WP Migrate DB Pro and Gravity Forms have supported for a long time.

  • Gotcha, thanks!

  • Just curious, was this added to ACF Pro in the end? The thread is marked as solved, but I can’t find any documentation on it. I’m having the same issue as others, ACF deactivates after a WP Migrate DB Pro migration. Having to manually reactivate it after each migration is a pain, the option to activate ACF via config would be nice.

    • fgilio

    • February 25, 2016 at 5:30 pm

    +1 super useful, I thought it was already a choice

    • rmmoul

    • April 28, 2016 at 5:31 am

    +1 for this. We use wpengine for 300+ client sites and we’re using AFC Pro on a good number of them. It’s been a pain point every month when doing updates in staging since the staging URL is different from the live URL, so we have to enter the license key in staging to update the plugin, and then again once we push the staging site live.

  • Hey @elliot, just curious if there is any official word on this?

  • Been awhile since there was activity on this one, figured I’d followup. I’d also like a way to apply my ACF key from the wp-config.php file. Recently been batch installing Let’s Encrypt SSL on my customer sites. Whenever there is a url change (like http:// to https://), ACF Pro drops the license and makes me reactivate. Having it applied from wp-config.php would solve this.

    Another common scenario I run into is when I go from a development site to production (like newsite.wpengine.com to newsite.com). This also drops the license key and requires manually intervention to reapply.

  • As for code, maybe do what Akismet does. In wp-config.php it looks like define( 'WPCOM_API_KEY', '238r9hsvdu8923' );. Doing a search for WPCOM_API_KEY over Akismet reveals the following related lines of code.

    
    /wp-content/plugins/akismet/class.akismet.php:
       61  
       62  	public static function get_api_key() {
       63: 		return apply_filters( 'akismet_get_api_key', defined('WPCOM_API_KEY') ? constant('WPCOM_API_KEY') : get_option('wordpress_api_key') );
       64  	}
       65  
    
    /wp-content/plugins/akismet/wrapper.php:
        1  <?php
        2  
        3: global $wpcom_api_key, $akismet_api_host, $akismet_api_port;
        4  
        5: $wpcom_api_key    = defined( 'WPCOM_API_KEY' ) ? constant( 'WPCOM_API_KEY' ) : '';
    
    /wp-content/plugins/akismet/views/config.php:
       59  									<table cellspacing="0" class="akismet-settings">
       60  										<tbody>
       61: 											<?php if ( !defined( 'WPCOM_API_KEY' ) ):?>
       62  											<tr>
       63  												<th class="akismet-api-key" width="10%" align="left" scope="row"><?php esc_html_e('API Key', 'akismet');?></th>
       ..
      138  								</div>
      139  								<div id="major-publishing-actions">
      140: 									<?php if ( !defined( 'WPCOM_API_KEY' ) ):?>
      141  									<div id="delete-action">
      142  										<a class="submitdelete deletion" href="<?php echo esc_url( Akismet_Admin::get_page_url( 'delete_key' ) ); ?>"><?php esc_html_e('Disconnect this account', 'akismet'); ?></a>
    
    
    • theshae

    • January 28, 2017 at 5:19 am

    @elliot Any update on this? This would be a HUGE time saver.

    • Dalton

    • January 31, 2017 at 10:41 am

    Adding my +1 here, this comes back every time I migrate a database from dev to staging to production or back again. It seems I’m re-entering my license information 5 – 10 times a day.

Viewing 25 posts - 1 through 25 (of 74 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.