Programmatically setting ACF license key

You can use the following code to inject the Advanced Custom Fields Pro license key automatically:

add_filter(
    'pre_option_acf_pro_license',
    function ($value, $option, $default) {
        return base64_encode(
                serialize(
                    [
                        'key' => '...',
                        'url' =>  home_url(),
                    ]
                )
        );
    },
    10,
    3
);

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.