How to set your ACF Pro license key via WP CLI

I don’t know about you, but I’m sick of manually setting up this key when I update a local environment or kick off a new install. So, after finally digging into WP CLI as a possible config path, I have this very quick tip for setting your ACF Pro license key using WP CLI:

wp eval 'acf_pro_update_license("PUT_YOUR_KEY_HERE");'

Throw that into a shell script that you can run after pulling a production DB to your local dev environment or as part of a provisioning process for a new install and you’ll never have to manually set this again.

This will be a good solution until ACF adds a config constant for setting license keys.

One last thing…

If you liked this article, I'd be incredibly grateful if you tweeted about it.

Also, I don't send emails often but when I do, I try to fill them full of useful goodies. If you like code snippets & dev tips, join my mailing list. There's no catch but I'll probably want to tell you about any new plugins & tools I build.