EDIT – 2022-04-12
This code doesn’t actually work. I think it did while I was testing because of some glitches elsewhere. Instead, you can now just set the constant ACF_PRO_LICENSE
.
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
);