Replace YOUR_PRO_LICENSE_KEY
with your Advanced Custom Fields Pro license key.
read -r -d '' php_code << 'heredoc'
<?php
include_once( ABSPATH . 'wp-content/plugins/advanced-custom-fields-pro/acf.php');
$post = [
'acf_license' => 'YOUR_PRO_LICENSE_KEY',
'acf_version' => acf_get_setting('version'),
'wp_name' => get_bloginfo('name'),
'wp_url' => home_url(),
'wp_version' => get_bloginfo('version'),
'wp_language' => get_bloginfo('language'),
'wp_timezone' => get_option('timezone_string'),
];
$response = acf_updates()->request('v2/plugins/activate?p=pro', $post);
if( is_string($response) ) {
$response = new WP_Error( 'server_error', esc_html($response) );
}
if( is_wp_error($response) ) {
echo $response->get_error_message();
}
if( $response['status'] == 1 ) {
echo wp_strip_all_tags( $response['message'] );
acf_pro_update_license( $response['license'] ); // update license
} else {
echo wp_strip_all_tags( $response['message'] );
}
heredoc
echo -n "$php_code" > run.php
wp eval-file run.php
rm run.php
wp plugin update advanced-custom-fields-pro